无法使用Include包含php文件
我有一个名为index.php的页面,其中包括一个页面new_display.php,该页面还包括两个页面,即x.php和y.php include在本地主机上运行良好,但在我的主机上运行不好!我得到的错误是:- 警告:require(/interests/sketching/udis.php)[function.require]:无法打开流:第154行的/hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new_display.php中没有此类文件或目录 致命错误:require()[function.require]:在/hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new\u display.php第154行打开required'/interests/sketching/udis.php'(include_path=.:/usr/local/lib/php-5.2.17/lib/php)失败 目录如下: index.php->localhost/mysql new_display.php->localhost/mysql/interests/sketching/new_display.php(作为/interests/sketching/new_display.php包含在index.php中) 然后在new_display中,x.php和y.php包含为 /interests/sketching/x.php /interests/sketching/y.php 它在localhost中运行良好,但在域上发布页面时出错无法使用Include包含php文件,php,file,include,directory,Php,File,Include,Directory,我有一个名为index.php的页面,其中包括一个页面new_display.php,该页面还包括两个页面,即x.php和y.php include在本地主机上运行良好,但在我的主机上运行不好!我得到的错误是:- 警告:require(/interests/sketching/udis.php)[function.require]:无法打开流:第154行的/hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/
有人知道这为什么不起作用吗?
/
表示一个绝对路径,这意味着您的脚本正在文件系统的根目录中查找名为interests
的目录
相反,请尝试删除路径开始处的
/
,或将$\u SERVER['DOCUMENT\u ROOT']]
添加到路径前面。/
表示绝对路径,这意味着您的脚本正在文件系统的根目录中查找名为interests
的目录
相反,只需删除路径开头的/
,或者在服务器['DOCUMENT\u ROOT']前面加上$\u
require(interests/sketching/udis.php)
需要(兴趣/草图/udis.php)
没有“/”
因为您必须指向同一个文件夹;) 你必须做出决定
require(interests/sketching/udis.php)
需要(兴趣/草图/udis.php)
没有“/”
因为您必须指向同一个文件夹;) 你能给我一个小例子,说明$\u服务器['DOCUMENT\u ROOT']的工作原理以及如何使用它吗?请@kolinkUseecho$\u SERVER['DOCUMENT\u ROOT']
查看变量中的内容。你能给我一个小例子说明一下$\u服务器['DOCUMENT\u ROOT']的工作原理以及我如何使用它吗?请@kolinkUseecho$\u SERVER['DOCUMENT\u ROOT']
查看变量中的内容。这应该可以为你解释。