1. Trang chủ
  2. » Công Nghệ Thông Tin

PHP Developer''''s Dictionary- P72 docx

5 208 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 451,65 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

fopen Syntax int fopenstring filename, string mode, int [use_include_path]; Description The fopen function opens the file specified by filename and a pointer to the file is returned

Trang 1

2(010) Write

3(011) Write and execute

5(101) Read and execute

6(110) Read and write

7(111) Read, write, and execute

Table 9.4 Permissions Returned by fileperms() on a Windows System

7(111) Execute—files with a exe or bat extension

6(110) Write—normal files

4(100) Read—files with the read-only attribute

Note

The results of this function are cached by PHP Any subsequent calls to fileperms() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function

filesize()

Syntax

int filesize(string filename);

Description

The filesize() function returns the size, in bytes, of the file specified in filename

This function returns false, 0, if an error is encountered

Note

The results of this function are cached by PHP Any subsequent calls to filesize() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function

filetype()

Syntax

Trang 2

string filetype(string filename);

Description

The filetype() function returns the type of the file specified in filename The file

types returned are fifo, char, dir, block, link, file, and unknown In Windows, this function returns either file or directory This function returns false, 0, if an error

is encountered

Note

The results of this function are cached by PHP Any subsequent calls to filetype() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function

flock()

Syntax

bool flock(int fp, int operation);

Description

The flock() function locks the file referenced by fp This function uses a method of

locking that requires all other programs to lock the file in the same way The methods of locking the file are listed in Table 9.5

Table 9.5 Operation Parameters Used by the flock() Function

Note

The flock() function works on Windows platforms and UNIX platforms

Trang 3

The flock() function returns true, 1, if the operation is successful

fopen()

Syntax

int fopen(string filename, string mode, int [use_include_path]);

Description

The fopen() function opens the file specified by filename and a pointer to the file is

returned The mode defines the mode in which the file will be opened The mode

options are listed in Table 9.6

Table 9.6 Modes for the fopen() Function

r Opens the file in read-only mode and places the file pointer, fp at the beginning

of the file

r+ Opens the file in read/write mode and places the file pointer, fp , at the

beginning of the file

w Creates a new file in write mode and places the file pointer, fp , at the

beginning of the file If a file exists, it is overwritten with the new file

w+ Creates a new file in read/write mode and places the file pointer, fp , at the beginning of the file If the file exists, it is overwritten with the new file

a Opens the file in write mode and places the file pointer, fp , at the end of the file If the file does not exist, it will be created

a+ Opens the file in read/write mode and places the file pointer, fp , at the end of the file If the file does not exist, it will be created

If filename begins with "http://", an HTTP 1.0 connection will be opened to the URL and the file pointer will be placed at the beginning of the response text

If filename begins with "ftp://", an FTP connection will be opened to the specified

server and the file pointer will be placed at the beginning of the requested file

Note

An error will be returned if the FTP server does not support passive mode

The optional parameter use_include_path can be set to "1" if you want to use the

include_path to search for the file

fpassthru()

Trang 4

Syntax

int fpassthru(int fp);

Description

The fpassthru() function reads the file pointed to by fp and writes the file to

standard out, which is usually the browser The file is read until End of File, EOF This function returns true, 1, if the function is successful

fputs()

Syntax

int fputs(int fp, string str, int [length]);

Description

The fputs() function is identical to the fwrite() function It writes the contents of

string to the file defined by fp The length parameter is optional and if it is not

specified, the entire string will be written; otherwise, writing will stop after length bytes are written This function returns false, 0, if an error occurred

fread()

Syntax

string fread(int fp, int length);

Description

The fread() function reads length bytes from the file referenced by fp Reading

stops when length bytes have been read or EOF is reached, whichever comes first

fseek()

Syntax

int fseek(int fp, int offset);

Trang 5

Description

The fseek() function sets the file pointer, fp , to offset bytes from the start of the

file

Note

The fseek() function will not return an error if you seek past the end of the file, EOF

ftell()

Syntax

int ftell(int fp);

Description

The ftell() function returns the position of the file pointer referenced by fp The

function returns false, 0, if it is not successful

fwrite()

Syntax

int fwrite(int fp, string string, int [length]);

Description

The fwrite() function writes the contents of string to the file defined by fp The

length parameter is optional and if it is not specified, the entire string will be

written; otherwise, writing will stop after length bytes are written

set_file_buffer()

Syntax

int fwrite(int fp, int buffer);

Ngày đăng: 07/07/2014, 05:20

TỪ KHÓA LIÊN QUAN