set_include_path()function 是一個內置函數PHP設置 include_path 配置選項。
用法:
string|false set_include_path(string $include_path)
Parameters: 該函數接受一個參數,如下所述:
- $include_path: 此參數指定include_path 的新值。
返回值:如果成功,此函數返回舊的include_path,否則返回“false”。
示例 1:在此示例中,我們將使用set_include_path()函數。
PHP
<?php
$path = "/home/dachman" ;
if(true == set_include_path($path)){
echo "Path is set now" ;
} else {
echo "Path is not set now" ;
}
?>
輸出:
The path is set now
示例 2:在下麵的代碼中,我們將在使用之前檢查路徑set_include_path()函數。
PHP
<?php
$path = "/home/dachman" ;
// Before using set_include_path() function.
echo get_include_path()."\n";
set_include_path($path) ;
echo get_include_path() ;
?>
輸出:
.:/usr/share/php /home/dachman
參考: https://www.php.net/manual/en/function.set-include-path.php
相關用法
- PHP set_file_buffer()用法及代碼示例
- PHP set_error_handler()用法及代碼示例
- PHP set_exception_handler()用法及代碼示例
- PHP settype()用法及代碼示例
- PHP setlocale()用法及代碼示例
- PHP session_abort()用法及代碼示例
- PHP session_cache_expire()用法及代碼示例
- PHP session_cache_limiter()用法及代碼示例
- PHP session_commit()用法及代碼示例
- PHP session_create_id()用法及代碼示例
- PHP session_decode()用法及代碼示例
- PHP session_destroy()用法及代碼示例
- PHP session_encode()用法及代碼示例
- PHP session_gc()用法及代碼示例
- PHP session_get_cookie_params()用法及代碼示例
- PHP session_id()用法及代碼示例
- PHP session_module_name()用法及代碼示例
- PHP session_name()用法及代碼示例
- PHP session_regenerate_id()用法及代碼示例
- PHP session_register_shutdown()用法及代碼示例
- PHP session_reset()用法及代碼示例
- PHP session_save_path()用法及代碼示例
- PHP session_set_cookie_params()用法及代碼示例
- PHP session_set_save_handler()用法及代碼示例
- PHP session_start()用法及代碼示例
注:本文由純淨天空篩選整理自neeraj3304大神的英文原創作品 PHP set_include_path() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。