fgets Syntax string fgetsint fp, int length; Description The fgets function reads the file referenced by fp and returns a string of length – 1.. fgetss Syntax string fgetssint fp,
Trang 1Description
The fgetcsv() function gets a line of data from a comma-separated value (CSV) file referenced by the file pointer, fp It returns an array with the values separated by
the optional delimiter If delimiter is not specified, a comma (,) is assumed The
parameter length is the longest line of the CSV file allowing for trailing carriage
returns and line feeds
Note
A blank line in the input CSV file will be translated into an array with one null field The blank line will not be interpreted as an error
fgets()
Syntax
string fgets(int fp, int length);
Description
The fgets() function reads the file referenced by fp and returns a string of length –
1 If an end of file (EOF) is reached, the length parameter is ignored and the string
is returned The function will return false, 0, if there is an error reading the file
fgetss()
Syntax
string fgetss(int fp, int length, string [allowable_tags]);
Description
The fgetss() function reads the file referenced by fp , and returns a string of length
–1 If an end of file (EOF) is reached, the length parameter is ignored and the string
is returned This function strips out any HTML or PHP tags from the input file The optional parameter allowable_tags defines any tags that are not to be stripped out
of the input file The function will return false, 0, if there is an error reading the file
file()
Trang 2Syntax
array file(string filename, int [use_include_path]);
Description
The file() function reads the file specified by filename and returns an array
containing each line of the file If the optional parameter include_path is set to 1, the file will be searched for in the include path
file_exists()
Syntax
int file_exists(string filename);
Description
The file_exists() function checks for the file defined by filename and if it exists,
the function returns true, 1 If the file doesn't exist, false, ((0)) is returned
Note
The results of this function are cached by PHP Any subsequent calls to file_exists() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function
fileatime()
Syntax
int fileatime(string filename);
Description
The fileatime() function returns the last access time of the file defined by
filename The format of this time is the standard UNIX time format, which is the
number of seconds since the start of the UNIX epoch, or January 1, 1970 The function returns false, 0, if an error is returned
Trang 3Note
The results of this function are cached by PHP Any subsequent calls to fileatime() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function
filectime()
Syntax
int filectime(string filename);
Description
The filectime() function returns the last changed time of the file specified by
filename The format of this time is the standard UNIX time format, which is the
number of seconds since the start of the UNIX epoch, or January 1, 1970 This function returns false, 0, if an error was encountered
Note
The results of this function are cached by PHP Any subsequent calls to filectime() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function
filegroup()
Syntax
int filegroup(string filename);
Description
The filegroup() function returns the group identifier (GID) of the owner of the file specified by filename This function returns false, 0, if an error is encountered
Windows always returns false, 0
Note
Trang 4The results of this function are cached by PHP Any subsequent calls to filegroup() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function
fileinode()
Syntax
int fileinode(string filename);
Description
The fileinode() function returns the inode number of the file specified by filename This function returns false, 0, if an error is encountered Because Windows does not have an equivalent, it always returns false, 0
Note
The results of this function are cached by PHP Any subsequent calls to fileinode() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function
filemtime()
Syntax
int filemtime(string filename);
Description
The filemtime() function returns the last modified time of the file specified by
filename The format of this time is the standard UNIX time format, which is the
number of seconds since the start of the UNIX epoch, or January 1, 1970 This function returns false, 0, if an error is encountered
Note
Trang 5The results of this function are cached by PHP Any subsequent calls to filemtime() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function
fileowner()
Syntax
int fileowner(string filename);
Description
The fileowner() function returns the user identifier (UID) of the owner of the file specified in filename This function returns false, 0, if an error is encountered
Because Windows does not have an equivalent, it always returns false, 0
Note
The results of this function are cached by PHP Any subsequent calls to fileowner() will return the same results even if the environment has changed The cache is cleared through the clearstatcache() function
fileperms()
Syntax
int fileperms(string filename);
Description
The fileperms() function returns the permissions on the file specified by filename (see Tables 9.3 and 9.4) The permissions are returned in the standard octal or binary format This function returns false, 0, if an error is encountered
Table 9.3 Permissions Returned by fileperms() on a UNIX System
0(000) No permissions
1(001) Execute