background image

22.    

// 绑定数据源,参数为一数组

23.    

function

 

BindData

(

$arr

)

24.    

{

25.    $this

->

DataSource

 

=

 $arr

;

26.    

}

27.  
28.    

// 设置文件存放路径

29.    

function

 

SetDir

(

$dir

)

30.    

{

31.    $this

->

Dir

 

=

 $dir

;

32.    

}

33.    

function

 

SetFileName

(

$fileName

)

34.    

{

35.    

return

 $this

->

fileName 

=

 $fileName

;

36.    

}

37.  
38.    

function

 

GetMod

()

39.    

{

40.    

return

 $this

->

mod

;

41.    

}

42.    

function

 

SetMod

(

$mod

)

43.    

{

44.    

return

 $this

->

mod 

=

 $mod

;

45.    

}

46.    

function

 

Open

()

47.    

{

48.    

if

 

(

substr

(

$this

->

fileName

,

 

0

,

 

1

)

 

==

 

"/"

)

49.    $this

->

fileName 

=

 $_SERVER

[

'DOCUMENT_ROOT'

]

 

.

 $this

->

fileName

;

50.    

if

 

(

$this

->

handle 

=

 fopen

(

$this

->

fileName

,

 $this

->

mod

))

51.    

return

 $this

->

handle

;

52.    

else

53.    

return

 

false

;

54.    

}

55.    

function

 

Close

()

56.    

{

57.    

return

 fclose

(

$this

->

handle

);

58.    

}

59.    

function

 

Write

(

$content

)

60.    

{

61.    

return

 fwrite

(

$this

->

handle

,

 $content

);

62.    

}

63.    

function

 

MkDir

(

$pathname

)

64.    

{

65.    $currentPath 

=

 

""

;