首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么这在WordPress functions.php中不起作用?

为什么这在WordPress functions.php中不起作用?
EN

Stack Overflow用户
提问于 2011-09-18 20:59:30
回答 1查看 955关注 0票数 0
代码语言:javascript
复制
$file = 'my/path/to/htaccess/location/.htaccess';

$htaccess = file($file);

$ht = fopen($htaccess,'a');

fwrite($ht,"deny");

fclose($ht);

我试图通过.htaccess修改functions.php文件,CHMOD设置为777,有什么想法吗?

编辑:

刚刚启用的错误:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-18 21:24:25

代码语言:javascript
复制
$file = 'http://'.$_SERVER['SERVER_NAME'].'/beta/.htaccess';

使请求的路径成为http路径。

这是没有意义的-你想要使用一个文件路径。

你可以用

代码语言:javascript
复制
$file = $_SERVER['DOCUMENT_ROOT'].'/beta/.htaccess';

而不是。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7464432

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档