【问题标题】:load xml file in php - missing access rights?在 php 中加载 xml 文件 - 缺少访问权限?
【发布时间】:2012-11-30 13:49:03
【问题描述】:

我想用下面的代码从某个链接读取一个XML文件

$filename = 'http://XXXXX/rss.xml';
$xml = simplexml_load_file($filename);

当我尝试时,我收到以下错误消息:

 wrapper is disabled in the server configuration by allow_url_fopen=0 

failed to open stream: no suitable wrapper could be found in 

I/O warning : failed to load external entity 

有什么问题?难道是服务器不支持simplexml_load_file?

【问题讨论】:

  • allow_url_fopen=0 是问题所在。将其设置为 true/1 以允许此操作,或尝试先下载文件。
  • 好的,我刚刚看到我无法通过我的提供者将其设置为 true。感谢您的帮助

标签: php xml access-rights


【解决方案1】:

allow_url_fopen 设置为0 时,您无权访问文件等URL 对象。阅读official manual了解更多信息。

您不能通过 .htaccess 更改此值,因此您必须在 php.ini 文件中设置 allow_url_fopen=1。如果您使用共享主机或其他类型的主机,您应该联系主机技术支持并向他们描述您的问题。

【讨论】:

    猜你喜欢
    • 2021-11-29
    • 2021-01-20
    • 2021-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-17
    • 2021-12-04
    相关资源
    最近更新 更多