【问题标题】:Error handling "URL file-access is disabled..."错误处理“URL 文件访问被禁用...”
【发布时间】:2012-04-28 20:01:11
【问题描述】:

我遇到了这两个错误:

警告:file_get_contents() [function.file-get-contents]:在服务器配置中禁用 URL 文件访问 /home/content/.../wp-content/themes/mytheme/functions.php 在第 4035 行

警告:file_get_contents(http://www.mysite.net/...y-1.7.2.min.js) [function.file-get-contents]:无法打开流:没有合适的 包装器可以在 /home/content/.../html/wp-content/themes/mytheme/functions.php 上线 4035

这是第 4035 行

$myFile=file_get_contents(get_bloginfo('template_directory')."/js/jquery-1.4.2.min.js");

这只是服务器上的权限问题吗?我如何包装这个函数来防止错误并退出到有用的消息?

【问题讨论】:

  • allow_url_fopen 在 php.ini 中被关闭。打开它或联系您的服务器管理员,他们可能有理由允许它。

标签: php error-handling


【解决方案1】:

您需要在 php.ini 配置文件中启用 allow_url_fopenallow_url_include(如果您想使用 include 加载远程资源)。另外,您可以尝试将其添加到.htaccess,但如果您将 php 作为 apache 模块运行,我认为它不会起作用 - 它不应该覆盖此设置...

php_value allow_url_fopen On

【讨论】:

    猜你喜欢
    • 2019-08-09
    • 1970-01-01
    • 2013-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-04
    • 1970-01-01
    相关资源
    最近更新 更多