Home > php教程 > php手册 > body text

PHP file()函数

WBOY
Release: 2016-06-13 11:16:50
Original
1472 people have browsed it

PHP file()函数以前我用file函数写过一个在WEB杀毒程序哦,其实就是file把一个txt文件直接读取并保存到数组中去了,那我我想你也知道它的作用是什么了吧,file读取文件就是把txt文件里的第一行放入数组里面  

PHP file()函数以前我用file函数写过一个在WEB杀毒程序哦,其实就是file把一个txt文件直接读取并保存到数组中去了,那我我想你也知道它的作用是什么了吧,file读取文件就是把txt文件里的第一行放入数组里面

语法:

定义和用法
该文件( )读取一个文件到一个数组。

每个数组元素包含从该文件,与换行符仍然重视。

语法

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 任择。指定范围内的档案处理。背景是一组选项,可以修改的行为流。可以跳过用空。
Copy after login
Copy after login

提示和说明 提示:此功能成为二进制安全的PHP 4.3 。 (意思是这两个二进制数据,如图像和字符数据可以写入这个功能) 。 -------------------------------------------------- ------------------------------ 例如

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

 

输出。

 

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

 


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 Recommendations
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!