WordPress函数文档filter_SSL()
过滤URL并格式化为SSL 描述 Filters a URL and formats it as https …
过滤URL并格式化为SSL
描述
Filters a URL and formats it as https if necessary (is_ssl() and force_ssl_content() are both true).
用法
<?php filter_SSL( $url ) ?>
参数
$url
(string) (必填) The URL to format
默认值: None
示例
1
2
3
4
5
6
7
8
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
<?php
$url = ‘http://example.com/’;
$url = filter_SSL( $url );
echo $url; // ‘https://example.com/’ or ‘http://example.com/’ as needed.
?>
|
注意
- If $url is not a string, the Site Address is returned.
- 使用到 set_url_scheme() to set the scheme to https when needed.
历史
添加于 版本: 2.8.5
源文件
filter_SSL() 函数的代码位于 wp-includes/ms-functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* Formats a URL to use https.
*
* Useful as a filter.
*
* @since 2.8.5
*
* @param string URL
* @return string URL with https as the scheme
*/
function filter_SSL( $url ) {
if ( ! is_string( $url ) )
return get_bloginfo( ‘url’ ); // Return home blog url with proper scheme
if ( force_ssl_content() && is_ssl() )
$url = set_url_scheme( $url, ‘https’ );
return $url;
}
|
相关
set_url_scheme(), is_ssl(), force_ssl_content()
- 原文:http://codex.wordpress.org/Function_Reference/filter_SSL
类别:WordPress函数文档、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!