get_site_url 获取网站url地址

函数描述

get_site_url() 模板标签获取指定站点的站点url,根据相应的协议返回 ‘siteurl’ 选项值,如果is_ssl()为true,返回 ‘https’,否则为 ‘http’ ,如果 $scheme 为 ‘http’ 或 ‘https’, is_ssl() 将被覆盖。

使用方法

<?php get_site_url( $blog_id, $path, $scheme ); ?>

默认使用方法

<?php get_site_url(); ?> 

函数参数

参数 数据类型 是否必需 描述 默认值
$blog_id 整数 博客 ID 当前博客ID
$path 字符串 相对于站点URL的地址
$scheme 字符串 指定给站点url的上下文方案,当前可用的有: ‘http’, ‘https’, ‘login’, ‘login_post’, ‘admin’ 或 ‘relative’. null

返回值

(string) 添加有可选后缀路径的站点url

Filter

apply_filters( 'site_url', $url, $path, $orig_scheme, $blog_id );

使用示例

<?php echo get_site_url(); ?>

返回完整的URL

http://mz5u.cn
© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享