PHP文件读写
时间:2021-07-01 10:21:17
帮助过:3人阅读
- $handle = @ fopen ( "demo.txt" , "r" );
- if ( $handle ) {
- while (( $buffer = fgets ( $handle , 4096 )) !== false ) {
- echo $buffer ;
- }
- if (! feof ( $handle )) {
- echo "Error: unexpected fgets() fail\n" ;
- }
- fclose ( $handle );
- }
-
- echo '
'; -
- $length= readfile("demo.txt");
-
- echo '
'; -
- $file_str = 'demo.txt';
-
- if(file_exists($file_str))
- {
- echo file_get_contents($file_str);
-
- }
-
- ?>
|
PHP