是什么原因导致'索引未找到'CodeIgniter 3中的错误


What causes this 'index not found' error in CodeIgniter 3

我有一个应用程序,似乎运行良好,但我的日志每天都有几行这样的…

ERROR - 2015-07-30 12:19:07 --> Severity: Notice --> Undefined index: HTTP_HOST /application/config/database.php 67
ERROR - 2015-07-30 12:19:07 --> Severity: Notice --> Undefined index: HTTP_HOST /application/config/database.php 68
ERROR - 2015-07-30 12:19:07 --> Severity: Notice --> Undefined index: HTTP_HOST /application/config/database.php 69
ERROR - 2015-07-30 12:19:07 --> Severity: Notice --> Undefined index: HTTP_HOST /application/controllers/Inc.php 15

正如我所说的,应用程序似乎正常运行,但我依赖于使用$_SERVER['HTTP_HOST']来确保正确执行。这是CodeIgniter 3的已知问题吗?特别是数据库配置。根据我所在的实例,我使用不同的数据库。

谢谢你的建议。

代替$_SERVER['HTTP_HOST'],您可以尝试使用$_SERVER['SERVER_NAME']问题是您的服务器没有将HTTP_HOST发送到$_SERVER全局变量。这是很多次的情况,因服务器而异