PHP file() function_PHP tutorial

WBOY
Release: 2016-07-20 11:00:35
Original
1035 people have browsed it

PHP file() function I used the file function to write a WEB anti-virus program before. In fact, file directly reads a txt file and saves it into an array. Then I think you also know what it does. Well, file reads a file by putting the first line in the txt file into the array. ​

PHP file() function I used the file function to write a WEB anti-virus program before. In fact, file directly reads a txt file and saves it into an array. Then I think you also know its function. What is it? File reads a file by putting the first line in the txt file into an array

Syntax:

Definition and usage
The file() reads a file into an array.

Each array element is contained from the file, with newlines still valued.

Grammar

file(path,include_path,context)
Copy after login
Copy after login
Copy after login
		Parameter
Copy after login
Description
path 文件路径
include_path 任择。将此参数设置为'1 '如果你想搜寻档案中的include_path中(在php.ini中) ,以及
context 任择。指定范围内的档案处理。背景是一组选项,可以修改的行为流。可以跳过用空。
Description
path File path
include_path Optional. Set this parameter to '1' if you want to search files in include_path (in php.ini), and
context Optional. File processing within a specified range. A context is a set of options that can modify the flow of behavior. Can be skipped with empty space.
Copy after login
Copy after login

Tips and Instructions Tip: This feature becomes binary safe in PHP 4.3. (Meaning that both binary data such as image and character data can be written to this function). -------------------------------------------------- ------------------------------- For example

print_r(file("test.txt"));?>

Output.

Array([0] => a
Copy after login
[1] => b.[2] => c,[3] => d?)
Copy after login


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445504.htmlTechArticlePHP file() function I used the file function to write a WEB anti-virus program before. In fact, it is just file. txt file is directly read and saved into an array, then I think you also know how it works...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!