|
DIRECTORY_SEPARATOR:目录分隔符,linux上就是’/’ windows上是’’
PATH_SEPARATOR:路径分隔符,include多个路径使用,在win下,当你要include多个路径的话,你要用”;”隔开,但在linux下就使用”:”隔开的。
=================================================
get_include_path取得当前已有的环境变量,加上前面的设置就是新的系统include
=================================================
<h3 class="qtl2">请教PHP中的set_include_path()函数
<div class="reward">
<font color="#e50000">悬赏分:0 - 解决时间: 2009年10月18日 20时13分
<div class="content">有点疑惑,请各位指点。目录结构D://root //根目录root|-inc| |-a.php//设置了set_include_path('D:/root');| |-b.php||_index.phpa.php为基本配置文件,代码如下:<?phpset_include_path('D:/root');require_once('b.php'); //问:为什么这地方不是 'inc/b.php',一打这个路径就出错。?>index.php代码<?phprequire_once 'inc/a.php';……//其它代码?>
<h2 class="title icon_best">最佳答案
<div class="tbl2">
<div class="boxl2">
<div class="content">
<span style="color: #0000ff">如果路径是相对路径(./开头,或者../开头),则按照相对路径的情况对待。(如 include("./b.php"))<span style="color: #0000ff">如果是物理路径,则直接寻找该路径。(如 include("D:/root/inc/b.php"))<span style="color: #0000ff">如果路径不是相对开头。(如 include("b.php"))<span style="color: #0000ff">则查询php.ini里的include_path的路径。按照include_path的顺序依次查找。<span style="color: #0000ff">include_path的值可以通过set_include_path() 来改变include_path的路径。
附:php.ini里的include_path的路径格式参考: (编辑:安卓应用网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|