$file = 'my/path/to/htaccess/location/.htaccess';
$htaccess = file($file);
$ht = fopen($htaccess,'a');
fwrite($ht,"deny");
fclose($ht);我试图通过.htaccess修改functions.php文件,CHMOD设置为777,有什么想法吗?
编辑:
刚刚启用的错误:
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/tfbox/domains/ibrogram.com/public_html/themes/beta/wp-content/themes/beta/functions.php on line 133
Warning: file(http://themes.ibrogra.com/beta/.htaccess) [function.file]: failed to open stream: no suitable wrapper could be found in /home/tfbox/domains/ibrogram.com/public_html/themes/beta/wp-content/themes/beta/functions.php on line 133
Warning: fopen() [function.fopen]: Filename cannot be empty in /home/tfbox/domains/ibrogram.com/public_html/themes/beta/wp-content/themes/beta/functions.php on line 135
Warning: fwrite(): supplied argument is not a valid stream resource in /home/tfbox/domains/ibrogram.com/public_html/themes/beta/wp-content/themes/beta/functions.php on line 137
Warning: fclose(): supplied argument is not a valid stream resource in /home/tfbox/domains/ibrogram.com/public_html/themes/beta/wp-content/themes/beta/functions.php on line 139发布于 2011-09-18 21:24:25
这
$file = 'http://'.$_SERVER['SERVER_NAME'].'/beta/.htaccess';使请求的路径成为http路径。
这是没有意义的-你想要使用一个文件路径。
你可以用
$file = $_SERVER['DOCUMENT_ROOT'].'/beta/.htaccess';而不是。
https://stackoverflow.com/questions/7464432
复制相似问题