[英]Can not understand why i am getting a Undefined index error
Hi i am getting an error Undefined index: HTTP_HOST on this line can any of you tell me where i am going wrong 嗨,我收到一个错误未定义索引:这行上的HTTP_HOST可以告诉我我要去哪里了吗
define("SCH_WSLINK", "{$httpS}://{$_SERVER['HTTP_HOST']}");
cheers 干杯
is $httpS defined? 是$ httpS定义的?
$httpS = 'https';
define("SCH_WSLINK", "{$httpS}://{$_SERVER['HTTP_HOST']}");
The above code works for me... 上面的代码对我有用...
var_dump(SCH_WSLINK);
string(16) "https://test.loc"
the cause of your error is that $httpS is interpreted as a variable which is not defined ,this will work : 错误的原因是$ httpS被解释为未定义的变量,这将起作用:
<?php
define("SCH_WSLINK", "{\$httpS}://{$_SERVER['HTTP_HOST']}");
echo SCH_WSLINK;
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.