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

警告: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 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题