site_url

函式
site_url ( $path = '', $scheme = null )
引數
  • (string) $path Optional. Path relative to the site URL. Default empty.
    Required:
    Default: (empty)
  • (string|null) $scheme Optional. Scheme to give the site URL context. See set_url_scheme().
    Required:
    Default: null
返回值
  • (string) Site URL link with optional path appended.
定義位置
相關方法
sanitize_urlget_site_urlsite_icon_urlget_sitemap_urlesc_url
引入
3.0.0
棄用
-

site_url:該函式返回網站主頁的URL。你可以使用這個函式來生成你網站上其他頁面的URL: 這個函式需要一個可選的引數–$path–允許你指定一個將被附加到基本URL上的路徑。

檢索當前網站的URL,其中WordPress應用檔案(例如wp-blog-header.php或wp-admin/資料夾)可以訪問。

返回帶有適當協議的“site_url”選項,如果是_ssl(),則返回’https’,否則返回’http’。如果$scheme為http’或’https’,則is_ssl() 將被重寫。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function site_url( $path = '', $scheme = null ) {
return get_site_url( null, $path, $scheme );
}
function site_url( $path = '', $scheme = null ) { return get_site_url( null, $path, $scheme ); }
function site_url( $path = '', $scheme = null ) {
	return get_site_url( null, $path, $scheme );
}

常見問題

FAQs
檢視更多 >