调试正在投掷…
Notice: Undefined index: HTTPS in
C:\xampplite\htdocs\testsite\wp-content\themes\mytheme\header.PHP
on line 4
function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} }
这会是等同的吗?
if ( isset( $_SERVER["HTTPS"] )) {$pageURL .= "s";}
如果请求不安全,一些服务器根本不设置
$_SERVER['HTTPS']
.有些人可能会将其设为“关闭”.你必须这样检查:
if ( isset( $_SERVER["HTTPS"] ) && strtolower( $_SERVER["HTTPS"] ) == "on" ) { $pageURL .= "s"; }