這篇文章主要介紹了php中的路徑問題與set_include_path,需要的朋友可以參考下
first:
php中常用的路徑
當前文件路徑:D:/phpweb/php_example/include_path.php
second:
php中的set_include_path
在php中,include文件時,當包含路徑不為相對也不為絕對時(如:include("example.php")),會先查找include_path所設置的目錄,然后再在當前目錄查找,這也是為什么很多資料上提到include("./example.php")比include("example.php")效率高的原因。
方法:
1.ini_set("include_path", "/usr/lib/pear"); //所有版本
2.set_include_path("/usr/lib/pear"); //version>=4.3.0
可以用下面的方法,在原有目錄上添加目錄
新聞熱點
疑難解答