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.