PHP Example Tutorial PHP tutorial-php Read Output Other file method

Source: Internet
Author: User
Tags fread php example
PHP Tutorial-php Read output other file methods
People tend to think of some kind of slow, white-page phenomenon, and if you have a test environment, you can restart PHP's php-fpm process and find out again, a similar problem over time, and we've invited Brother even PHP education www.lampbrother.net PHP Daniel for everyone to share, PHP read output Other file method, thanks to Tetsushige for us to bring this carefree experience, small partners, ready for this technology trip?
Ob_start ();
Iconv (' Utf-8 ', ' gb2312 ', ReadFile (' 1.html ')); Direct output of text content
Echo ';
$data = file_get_contents ('./1.html ', null,null,0,10);
Var_dump ($data);//Output string
Echo ';
$data = File ('./1.html ');
Var_dump ($data);//output array
Echo ';
$stream = fopen ('./1.html ', ' R ');
Echo stream_get_contents ($stream, 12);//Output string
Echo ';
Fread () reads files (which are safe for binary files) file system pointers, which are typically resource (resources) created by fopen ().
$data = fopen ('./1.html ', ' RB ');
$contents = Fread ($data, FileSize ('./1.html '));
echo $contents;//Output string
PHP Tutorial summarizing PHP read output other file methods. Hope to be of help to everyone.

The above introduces PHP tutorial PHP tutorials-php Read output Other file methods, including the PHP instance tutorial content, I hope the PHP tutorial interested in a friend helpful.

  • 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.