Php file operations are very powerful, and you can easily read local files and remote files! 1. for details about how to use fread (), see the following php code: & amp; lt ;? Php?file="=phpddt.txt & quot; $ fp = fopen ($ f
Php file operations are very powerful, and you can easily read local files and remote files!
1. use fread () to obtain
See the following php code:
Running result:
Php point-to-point (www.phpddt.com), follow php development, and provide professional php tutorials!
2. fseek (resource handle, int offset [, int whence]) to offset the pointer to the offset.
(Php.txt content is [Welcome to www.phpddt.com ])
After running the following php code:
Result:
To www.phpddt.com
The whence parameters are described as follows:
SEEK_SET-set the position to be equal to the offset byte.
SEEK_CUR-set the position to add offset to the current position.
SEEK_END-set the position to add offset to the end of the file. (Assign value)
If no whence is specified, the default value is SEEK_SET.
3. the ftell () function is used to obtain the offset of the pointer position.
The php demo code is as follows:
Running result:
8
4. the rewind () function moves the file pointer to the specified position.
5. the parse_ini_file () function parses the. ini file and easily parses multi-dimensional arrays.Let's take a look at the php Tutorial below!
First, save the phpddt. ini file. the file content is as follows:
[Web1]
Url = "www.phpddt.com"
Name = php point-to-point
[Web2]
Url = "www.baidu.com"
Name = baidu search
Compile the following php code:
The running result is as follows:
Array
(
[Web1] => Array
(
[Url] => www.phpddt.com
[Name] => php point-to-point
)
[Web2] => Array
(
[Url] => www.baidu.com
[Name] => Baidu search
)
)