(PHP 4 >= 4.3.0, PHP 5)
set_include_path — 設(shè)置 include_path 配置選項(xiàng)
說明
string set_include_path ( string$new_include_path
)
為當(dāng)前腳本設(shè)置 include_path 運(yùn)行時(shí)的配置選項(xiàng)。
參數(shù)
new_include_path
include_path 新的值。
返回值
成功時(shí)返回舊的 include_path 或者在失敗時(shí)返回 FALSE
。
范例
Example #1 set_include_path() 例子
<?php
// 自 PHP 4.3.0 起可用
set_include_path('/usr/lib/pear');
// 在所有版本的 PHP 中均可用
ini_set('include_path', '/usr/lib/pear');
?>
Example #2 添加到include path
利用常量 PATH_SEPARATOR
可跨平臺(tái)擴(kuò)展 include path。
這個(gè)例子中我們把 /usr/lib/pear 添加到了 現(xiàn)有的 include_path 的尾部。
<?php
$path = '/usr/lib/pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
?>
參見
ini_set() - 為一個(gè)配置選項(xiàng)設(shè)置值 get_include_path() - 獲取當(dāng)前的 include_path 配置選項(xiàng) restore_include_path() - 還原 include_path 配置選項(xiàng)的值 include - include