php 写入和读取文件函数
//读取文件函数 <? function readfromfile( $file_name ) { if ( file_exists ( $file_name )) { $filenum = fopen ( $file_name , "r" ); flock ( $filenum ,lock_ex); $file_data = fread ( $filenum , filesize ( $file_name )); rewind ( $filenum ); //osphp.com.cn fclose( $filenum ); return $file_data ; } } ?> //写入文件函数 <? function writetofile( $file_name , $data , $method = "w" ) { $filenum = fopen ( $file_name , $method ); flock ( $filenum ,lock_ex); $file_data =fwrite( $filenum , $data ); fclose( $filenum ); return $file_data ; } ?>查看更多关于php 写入和读取文件函数 - php文件操作的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did27857