嗨,我收到一个错误 Undefined index: HTTP_HOST on this line 你们谁能告诉我哪里出错了
define("SCH_WSLINK", "{$httpS}://{$_SERVER['HTTP_HOST']}");
干杯
您的错误的原因是 $httpS 被解释为未定义的变量,这将起作用:
<?php
define("SCH_WSLINK", "{\$httpS}://{$_SERVER['HTTP_HOST']}");
echo SCH_WSLINK;
?>
$httpS 定义了吗?
$httpS = 'https';
define("SCH_WSLINK", "{$httpS}://{$_SERVER['HTTP_HOST']}");
上面的代码对我有用......
var_dump(SCH_WSLINK);
string(16) "https://test.loc"