get_site_url()
get_site_url( int $blog_id = null, string $path = ”, string $scheme = null )
检索给定网站的URL,其中WordPress应用程序文件(例如wp blog-header.php文件或wp管理/文件夹)可访问。
Retrieves the URL for a given site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.
说明(Description)
使用适当的协议返回“site_url”选项,如果是_ssl(),则返回“https”,否则返回“http”。如果$scheme是’http’或’https’,is_ssl()将被重写。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$blog_id | (int) | 可选 | 站点ID。默认为空(当前站点)。 |
$path | (string) | 可选 | 相对于网站URL的路径。 |
$scheme | (string) | 可选 | 提供网站URL上下文的方案。接受“http”、“https”、“login”、“login-post”、“admin”或“relative”。 |
返回(Return)
(string)附加了可选路径的站点URL链接。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
3.0.0 | wp-includes/link-template.php:3248 | 4 | 7 |
笔记(Notes)
显示完整网站URL的结果:
该值没有尾随斜杠,例如。,https://www.example.com网站,不是https://www.example.com/。
当你也需要通过这个计划的时候。
get_site_url() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_site_url/