欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php中的路徑問(wèn)題與set_include_path使用介紹

 更新時(shí)間:2014年02月11日 17:00:22   作者:  
這篇文章主要介紹了php中的路徑問(wèn)題與set_include_path,需要的朋友可以參考下
first:

php中常用的路徑

當(dāng)前文件路徑:D:\phpweb\php_example\include_path.php
復(fù)制代碼 代碼如下:

1.dirname(__FILE__); //輸出D:\phpweb\php_example
2.$_SERVER['SCRIPT_FILENAME']; //輸出D:/phpweb/php_example/include_path.php

second:

php中的set_include_path

在php中,include文件時(shí),當(dāng)包含路徑不為相對(duì)也不為絕對(duì)時(shí)(如:include("example.php")),會(huì)先查找include_path所設(shè)置的目錄,然后再在當(dāng)前目錄查找,這也是為什么很多資料上提到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
可以用下面的方法,在原有目錄上添加目錄
復(fù)制代碼 代碼如下:

<?php
$path = '/usr/lib/pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);//設(shè)置后的include_path變?yōu)轭?lèi)似/usr/lib/function;/usr/lib/pear
?>

相關(guān)文章

最新評(píng)論