File system function library: Files

Source: Internet
Author: User
Keywords file php Chinese function manual file system function library
Tags aliyun array different file file system function library files function function library

File

(PHP3, PHP4)

File---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Read the entire contents of the file into an array

Syntax: Array file (string filename [, int use_include_path])

Description:

Same as ReadFile (), except that this function returns an array whose elements correspond to the number of rows in the file. New (newline) is still attached.

If you want to search for files in include_path, you can use the second argument and set it to "1".

<?php

Get a Web page to an array and print it out

$fcontents = File (' http://www.php.net ');

while (the list ($line _num, $line) = each ($fcontents)) {

echo "<b>line $line _num:</b>". Htmlspecialchars ($line). "<br>\n";

}

Get a Web page into a string

$fcontents = Join (', file (' http://www.php.net '));

?>

Reference: ReadFile () fopen () Popen ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.