我有一個問題:如何固定的錯誤注意:未定義指數:HTTPS在注意:未定義指數:HTTPS在
這行代碼:
public static function getCurrentURL() {
$requri = !isset($_SERVER['REQUEST_URI']) ? $_SERVER['PHP_SELF'] : $_SERVER['REQUEST_URI'];
$protocol = strtolower($_SERVER["SERVER_PROTOCOL"]);
$protocol = substr($protocol, 0, strpos($protocol, '/')) . ($_SERVER['HTTPS']=='on'?'s':'');
$port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $requri;
}
與錯誤行:
在第30行UID:$protocol = substr($protocol, 0, strpos($protocol, '/')) . ($_SERVER['HTTPS']=='on'?'s':'');
我得到這個錯誤的通知:未定義指數
$_UID = $_COOKIE['UID'] ? $_COOKIE['UID'] : 0;
而這個錯誤注意:未定義的變量:G_UID在第27行:
if ($G_UID && $G_URL && $G_ADT) {
$surl = SITE_LOCATION;
$db = System::getDB();
$user = $G_UID;
如果需要,我在這裏發佈的代碼完成。
謝謝。
你確定,該協議是HTTPS,而不是HTTP?原因在這種情況下索引未在服務器上定義 – 2014-11-24 13:46:39
我更改HTTP的HTTPS,但我得到兩個錯誤。 – 2014-11-24 13:48:50
下面的答案這是從這裏形式:http://stackoverflow.com/questions/4911532/undefined-index-error-using-serverhttps將工作 – 2014-11-24 13:49:30