查詢

get_include_path()函式—用法及示例

「 獲取當前 PHP 的 include_path 配置設定 」


函式名:get_include_path()

適用版本:所有 PHP 版本

函式描述:get_include_path() 函式用於獲取當前 PHP 的 include_path 配置設定。

用法示例:

// 獲取當前 include_path 配置設定
$path = get_include_path();

// 輸出 include_path 的值
echo $path;

解釋:

get_include_path() 函式返回一個包含當前 include_path 配置設定的字串。include_path 是 PHP 用於查詢檔案的一種搜尋路徑設定。在該示例中,我們呼叫 get_include_path() 函式並將其返回值儲存在變數 $path 中。然後,我們使用 echo 語句將 $path 的值輸出到螢幕上。

注意事項:

  • 如果沒有設定 include_path,get_include_path() 將返回一個空字串。
  • include_path 可以包含多個目錄路徑,每個路徑之間用分號(;)分隔。
  • get_include_path() 函式只返回 include_path 的當前設定,而不會修改它。要修改 include_path,請使用 set_include_path() 函式。

參考文件:get_include_path() - PHP 官方文件

補充糾錯
上一個函式: get_loaded_extensions()函式
下一個函式: get_included_files()函式
熱門PHP函式
分享連結