PHP 不在根目录的页面文件 include 其他不在根目录文件
基本是这个错误我的根目录文件结构
..
/conn/conn.php
/test.test.php
test.php有
include("/conn/conn.php")这句话
Warning:include(./conn/conn.php) [function.include]:failed to open stream: No such file or directory inD:\Program Files (x86)\AppServ\www\html4\mobile\setting_skins_mobile.phponline1
Warning:include() [function.include]:Failed opening './conn/conn.php' for inclusion (include_path='.;C:\php5\pear') inD:\Program Files (x86)\AppServ\www\html4\mobile\setting_skins_mobile.phponline1
无记录!
解决方法
include("../conn/conn.php")但是不能使用你的工程的文件夹名字代替".."
参考http://www.codingforums.com/showthread.php?t=170962
Ifyou have gone up a level and are referencing items down a level in the directory structure you will need to let PHP know this, by preceeding your file paths with "../" Here is an example:
Assumeyou have the following files:
afile.php
and
directory/myfile.php
ifyou want directory/myfile.php to include afile.php you will need to do the following:
PHP Code:
include('../afile.php');
orthis (only if its in the sites base directory):
PHP Code:
include('./afile.php');
页:
[1]