path_join

函式
path_join ( $base, $path )
引數
  • (string) $base Base path.
    Required:
  • (string) $path Path relative to $base.
    Required:
返回值
  • (string) The path with the base or absolute path.
定義位置
相關方法
update_optionwp_loginpopulate_optionsdate_i18nthe_shortlink
引入
2.5.0
棄用
-

path_join: 這個函式將兩個或多個路徑連線成一個單一的路徑。它需要兩個或多個引數。$path1, $path2, $path3, etc. (字串)表示要連線的路徑。

將兩個檔案系統的路徑連線在一起。

例如,”give me $path relative to $base”。如果$path是絕對的,那麼它將返回完整的路徑。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function path_join( $base, $path ) {
if ( path_is_absolute( $path ) ) {
return $path;
}
return rtrim( $base, '/' ) . '/' . $path;
}
function path_join( $base, $path ) { if ( path_is_absolute( $path ) ) { return $path; } return rtrim( $base, '/' ) . '/' . $path; }
function path_join( $base, $path ) {
	if ( path_is_absolute( $path ) ) {
		return $path;
	}

	return rtrim( $base, '/' ) . '/' . $path;
}

常見問題

FAQs
檢視更多 >