问题描述
我试图让 PHP 读取一个文件到最后,它工作得很好,除非文件为空。然后它抛出一个错误说:
Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0`
`strlen()`does not work in this case.
是否有一些关于长度的论据,例如“阅读那里的所有内容,如果它为空,则忽略它”?这是PHP:
$data_file_read = fopen("data.txt","r");
$alldata = fread($data_file_read,filesize("data.txt"));
fclose($data_file_read);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)