普通网友 2014-04-25 06:17
浏览 595
已采纳

警告:require_once():http://在服务器配置中禁用包装器allow_url_include = 0

I am trying to include a php file in a page via

  require_once(http://localhost/web/a.php)

I am getting an error

 Warning: require_once(): http:// wrapper is disabled in the server configuration by   allow_url_include=0

I changed allow_url_include=1 in the php.ini and that worked but I don't think that everybody will let me change their php.ini file.

So, is there any way to accomplish this?

  • 写回答

8条回答 默认 最新

  • dougu4027 2014-04-25 06:26
    关注

    The warning is generated because you are using a full URL for the file that you are including. This is NOT the right way because this way you are going to get some HTML from the webserver. Use:

    require_once('../web/a.php');
    

    so that webserver could EXECUTE the script and deliver its output, instead of just serving up the source code (your current case which leads to the warning).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

悬赏问题

  • ¥15 VB.NET2022如何生成发布成exe文件
  • ¥30 matlab appdesigner私有函数嵌套整合
  • ¥15 给我一个openharmony跑通webrtc实现视频会议的简单demo项目,sdk为12
  • ¥15 vb6.0使用jmail接收smtp邮件并另存附件到D盘
  • ¥30 vb net 使用 sendMessage 如何输入鼠标坐标
  • ¥15 关于freesurfer使用freeview可视化的问题
  • ¥100 谁能在荣耀自带系统MagicOS版本下,隐藏手机桌面图标?
  • ¥15 求SC-LIWC词典!
  • ¥20 有关esp8266连接阿里云
  • ¥15 C# 调用Bartender打印机打印