gpt4 book ai didi

mysql - Codeigniter - 我看不到数据库错误

转载 作者:搜寻专家 更新时间:2023-10-30 20:55:13 25 4
gpt4 key购买 nike

当我导航到链接时,我在浏览器中看不到 SQL 错误。

详情:

代码点火器 2.2.0

在我的 database.php 中有

$db['default']['dbdriver'] = 'mysql';
$db['default']['db_debug'] = TRUE;

我正在尝试连接到一个旧的 `MySQL: 5.1.73-cll"

我在 linux shell 中使用 MySQL 命令测试了 IP、用户和密码,它工作正常,我能够连接。

但是当我在 autoload.php 中将“数据库”添加到我的 $autoload['libraries'] 时,我的页面完全加载空白并且没有显示任何错误消息.如果我从 $autoload['libraries'] 中删除“数据库”,那么我的页面会正确加载。

如果我能看到错误,我至少会知道问题出在哪里。

谢谢!马吕斯

最佳答案

其中一个解决方案是在您的代码顶部添加它 -

ini_set('display_errors', 1);

检查链接: http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors



同时检查您的ENVIRONMENT。您可以将这些设置添加到您的基础 index.php

define('ENVIRONMENT', 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/

if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
/* Report all errors */
error_reporting(E_ALL);

/* Display errors in output */
ini_set('display_errors', 1);
break;

case 'testing':
case 'production':
/* Report all errors except E_NOTICE */
/* This is the default value set in php.ini */
error_reporting(E_ALL ^ E_NOTICE);

/* Don't display errors (they can still be logged) */
ini_set('display_errors', 0);
break;

default:
exit('The application environment is not set correctly.');
}
}

关于mysql - Codeigniter - 我看不到数据库错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24583139/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com