PHP fscanf functions
fscanf
(php 4 "= 4.0.1, PHP 5)
FSCANF-Parse the format of the input file according to
Describe
Mixed FSCANF (Resource $ processing, string $ format [, mixed &$ ...])
The function fscanf () is similar to sscanf (), but requires input from the archive with the input of processing and interpretation according to the specified format, which is described in the literature as sprintf ().
Any whitespace in the format string matches any blank input stream. This means that even if a label T in the format string can match a single space character in the input stream.
Each phone fscanf () reads a row from the archive.
Parameters
Handle
A file system pointer to a resource, typically created using the fopen () function.
Format
A file that specifies the sprintf () described in the format.
...
The specified value that is optional.
return value
If there are only two parameters, value resolution returns an array through this function. Otherwise, if an optional argument is passed, the function returns the specified number of values. Optional parameters must be passed by reference.
Modify
Release Notes
4.3.0 before this time, the maximum number of characters to read the file is 512 (or the first nitrogen, both ranked first). But now, any long rows are read and scanned.
Instance
Example # 1 fscanf () for example
$handle = fopen ("Users.txt", "R");
while ($userinfo = fscanf ($handle, "%ST%ST%SN")) {
List ($name, $profession, $countrycode) = $userinfo;
... do something with the values
}
Fclose ($handle);
?>
http://www.bkjia.com/PHPjc/445470.html www.bkjia.com true http://www.bkjia.com/PHPjc/445470.html techarticle php fscanf function fscanf (php 4 = 4.0.1, PHP 5) fscanf-Parse the format of the input file according to the description Mix fscanf (Resource $ processing, string $ format [, mixed $ ...]) ...