Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在PHP目录中查看文件_Php_Wordpress_File Handling - Fatal编程技术网

无法在PHP目录中查看文件

无法在PHP目录中查看文件,php,wordpress,file-handling,Php,Wordpress,File Handling,我通过这样的文件处理在我的服务器上保存一个文件 $my_file = $_SERVER['DOCUMENT_ROOT'].'/wp-content/themes/mythemev2.0/'.$name.'.php'; echo $my_file; $handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); fwrite($handle, $res->name); $my_file完美地显示了文件的完整路径

我通过这样的文件处理在我的服务器上保存一个文件

$my_file = $_SERVER['DOCUMENT_ROOT'].'/wp-content/themes/mythemev2.0/'.$name.'.php';
echo $my_file;
$handle = fopen($my_file, 'w') or die('Cannot open file:  '.$my_file);

fwrite($handle, $res->name);

$my_file完美地显示了文件的完整路径。但当我转到特定目录时,我无法看到该文件。可能是什么错误?我还能为调试做些什么?

确保在fwrite()之后调用fclose()

确保在fwrite()之后调用fclose()

是否检查了错误日志?是否调用fclose()?请显示apache的错误日志…@periklis否我没有调用它。@periklis调用fclose解决了我的问题。。。请将其添加为答案,以便我可以接受您是否检查了错误日志?您正在调用fclose()?请显示apache的错误日志…@periklis否我没有调用它…@periklis调用fclose解决了我的问题。。。请将其添加为答案,以便我可以接受