phpfile_put_contents出错,这是哪里的问题(php创建文件失败,提示无法打开,请高手指教!)
phpfile_put_contents出错,这是哪里的问题
出现failedtoopenstream:Permissiondeniedin是apache运行用户没用权限去访问指定的文件了,所以导致目录文件打不开了。
检查目标文件的地址注意要使用相对地址,非webroot的地址要设置权限
php创建文件失败,提示无法打开,请高手指教!
Warning:file_put_contents(/data/home/qxu1002120378/htdocs/)[function.file-put-contents]:failedtoopenstream:Isadirectory
从上面的提示,结合代码来看,建议在调用
file_put_contents($filename, $content);//输出
代码之前,查看一下$content的值及类型 。
file_put_contents函数的原型定义如下:
nt file_put_contents ( string $filename , mixed $data [, int $flags =0 [, resource $context ]])
其中 $data参数类型可以是 string,array 或者是 stream 资源。
也许您对下面的内容还感兴趣:
评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。





留言0