两个php文件路径如下:
/webservice/include/Client.php /webservice/Message.php
在Message.php中能成功require_once Client.php现在我想把Message.php放到另外一个文件夹,路径如下:
/webservice/controller/Message.php
然后再在Message.php中require_once Client.php就老是出错 报错内容如下:Fatal error: require_once() [function.require]: Failed opening required 'G:/VertrigoServ/www/webservice/include/Client.php' (include_path='.;G:\php\VertrigoServ\Smarty')求解该怎么引入
/webservice/include/Client.php /webservice/Message.php
在Message.php中能成功require_once Client.php现在我想把Message.php放到另外一个文件夹,路径如下:
/webservice/controller/Message.php
然后再在Message.php中require_once Client.php就老是出错 报错内容如下:Fatal error: require_once() [function.require]: Failed opening required 'G:/VertrigoServ/www/webservice/include/Client.php' (include_path='.;G:\php\VertrigoServ\Smarty')求解该怎么引入
$root = str_replace("\\","/",__DIR__);,这里公共文件是放在根目录下的这样client.php文件的引用就可以写成require_once($root."/webservice/include/Client.php")
{
$npath = str_replace('\\', '/', $path);
return str_replace(GetVar('DOCUMENT_ROOT'), '', $npath);
}
包含时请使用:
require_once(dirname(__FILES_)."/path/");