function read_file($filename){
// $filename = "/usr/local/something.txt";
$handle = @fopen($filename, "r");//读取二进制文件时,需要将第二个参数设置成'rb'
//通过filesize获得文件大小,将整个文件一下子读到一个字符串中
$contents = @fread($handle, filesize ($filename));
fclose($handle);
return $contents;
}
function write_file($filename,$txt){
$myfile = fopen($filename, "w") or die("Unable to open file!");
fwrite($myfile, $txt);
fclose($myfile);
return true;
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询