PHP file() 函数
PHP 教程
· 2019-01-24 21:14:18
定义和用法
file() 函数把整个文件读入一个数组中。
数组中的每个元素都是文件中相应的一行,包括换行符在内。
语法
file(path,include_path,context)
| 参数 | 描述 |
|---|---|
| path | 必需。规定要读取的文件。 |
| include_path | 可选。如果您还想在 include_path(在 php.ini 中)中搜索文件的话,请设置该参数为 '1'。 |
| context | 可选。规定文件句柄的环境。context 是一套可以修改流的行为的选项。若使用 NULL,则忽略。 |
提示和注释
提示:从 PHP 4.3 开始,该函数是二进制安全的。(意思是二进制数据(如图像)和字符数据都可以使用此函数写入。)
实例
<?php
print_r(file("test.txt"));
?>
上面的代码将输出:
Array ( [0] => Hello World. Testing testing! [1] => Another day, another line. [2] => If the array picks up this line, [3] => then is it a pickup line? )
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Out of their Minds
Dennis Shasha、Cathy Lazere / Springer / 1998-07-02 / USD 16.00
This best-selling book is now available in an inexpensive softcover format. Imagine living during the Renaissance and being able to interview that eras greatest scientists about their inspirations, di......一起来看看 《Out of their Minds》 这本书的介绍吧!
RGB转16进制工具
RGB HEX 互转工具
HEX CMYK 转换工具
HEX CMYK 互转工具