duanjue6575 2014-04-29 21:02
浏览 298
已采纳

警告:require()[function.require]:无法打开流:没有这样的文件或目录

This error is quite common and it generally means it can't find the file it's looking for, but I can see the file in the directory?!

Full error:

Warning: require(/home/coinsfut/public_html/files/core.php) [function.require]: failed to open stream: No such file or directory in /home/coinsfut/public_html/new/index.php on line 4

line 4 says:

require $_SERVER['DOCUMENT_ROOT']. "/files/core.php";

the site is hosting in /new

any ideas?

  • 写回答

1条回答 默认 最新

  • dousendun8411 2014-04-29 21:10
    关注

    Check the warning again. You are trying to include

    /home/coinsfut/public_html/files/core.php
    

    when in fact you want

    /home/coinsfut/public_html/new/files/core.php
    

    Please try

    require $_SERVER['DOCUMENT_ROOT']. "/new/files/core.php";
    

    and it should work just fine.

    Alternative you could use

    require "files/core.php";
    

    to include files in a relative sub-directory since your index.php is in "new" directory.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献