php file for relevant statements in


// open file the fopen ();
// open the file read-only mode r, r + w open reading and writing so as to write the opening w + open reading and writing (written in the form of a cover)
// write to A the way is open, the file does not create x create a new file exists

$ file = fopen ( './ abc.asd', 'r');
print_r ($ file);
// $ file = fopen ( 'HTTPS: / /www.baidu,com','r ');
// print_r ($ file);
echo' <br> ';

// read the contents of the file
$ file = ReadFile (' ./ asd.txt ');
var_dump ($ File); // print and type (bytes)
echo '<HR>';
print_r ($ File); // number of bytes print
echo '<br>';
echo $ File; // print word section number
echo '<br>';
// read the contents of the file using the file
// in the form of an array and returns the result
echo '<HR>';
$ file = Flie ( './ asd.txt');
var_dump ($ Flie);
echo '<br>';
print_r($file);

echo '<br>';

// read the contents of the file and returns a string
$ file = file_get_contents ( './ asd.txt '); // direct access to content
print_r ($ file); // outputting content
echo '<br>';
// $ file = file_get_contents ( 'http://ailongmiao.com' ); // Get the page source
// echo $ file; // outputting content
// $ wri = file_put_contents ( './ abc.txt', $ file ); // write abct.txt

// read the file line
// fgets (resource file, byte length)
// UTF8 characters in a 3-byte
$ file = fopen ( './ asd . TXT ',' R & lt ');
$ fgets = fgets ($ File,. 7); // will return word. 7, return multiple of one byte
print_r ($ fgets);
echo' <br> ';

// that fgetss (resources) can filter portion html code
$ File = the fopen ( './ asd.txt', 'R & lt');
the while (that fgetss = STR $ ($ File)) {
echo "STR $";
}
echo '<br > ';

// read only one character ggtc, not in Chinese
The fopen $ File = // ( './ asd.txt', 'R & lt');
// the while (STR $ = fgetc ($ File)) {// read a character, the vertical output cycle, output out characters
/ / echo $ str;
; // echo '<br>'
//}

// write to the file fputs () file_put_contents ()
when $ str = 'see deer deep forest, the deep sea when see whales, wake up see you ';
$ File = the fopen (' ./ asd.txt ',' W '); // read-write form W, and overwrites the original contents of
$ Result = fputs (File $, $ STR);
print_r ($ result); // print the number of characters
echo '<br>';

// fwrite ()
$ str = 'probably because you BA';
$ File = fopen ( './ asd.txt', 'r');
$ = fwrite the Result ($ File, $ str);
print_r ($ the Result);

// file_put_contents ()
$ str = 'have rain, vegetation students';
$ the Result = file_put_contents ( './ asd.txt', $ str); // form it has covered the content posted asd.txt
print_r($result);



Guess you like

Origin www.cnblogs.com/simple827/p/11875813.html