ahkxhyl 发表于 2012-8-28 10:40:56

关于CI错误

别人恶意访问不存在的页面,爆路径如图所示:,我想屏蔽这个错误信息 应该怎么做。。也不知道为什么程序也没调用到404页面,
INDEX.PHP代码
define('ENVIRONMENT', 'development');


if (defined('ENVIRONMENT'))
{
        switch (ENVIRONMENT)
        {
                case 'development':
                        error_reporting(E_ALL ^ E_NOTICE);

                break;
       
                case 'testing':
                case 'production':
                        error_reporting(0);
                break;

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

db_driver.php代码

function query($sql, $binds = FALSE, $return_object = TRUE)
        {
                if ($sql == '')
                {
                        if ($this->db_debug)
                        {
                                log_message('error', 'Invalid query: '.$sql);
                                return $this->display_error('db_invalid_query');
                        }
                        return FALSE;
                }

============================
请问我该怎么做,别人恶意访问不存在的页面 导致爆站路径

jeongee 发表于 2012-8-28 10:54:02

config/database.php 下的配置里有个错误开关
一切尽在CI的手册,楼主还需多研究研究

ahkxhyl 发表于 2012-8-28 11:01:48

jeongee 发表于 2012-8-28 10:54 static/image/common/back.gif
config/database.php 下的配置里有个错误开关
一切尽在CI的手册,楼主还需多研究研究 ...

$db['default']['db_debug'] = false;我关闭了 所以不报错了 但是还是影响到页面,继续求方法。或者让他载入404页面也行

jeongee 发表于 2012-8-28 11:06:00

你重写error_handler

ahkxhyl 发表于 2012-8-28 11:56:11

jeongee 发表于 2012-8-28 11:06 static/image/common/back.gif
你重写error_handler

谢谢了

qq494686707 发表于 2012-8-28 12:13:27

数据库的错误信息最好还是解决它,屏蔽对站点没有好处。

大道达人 发表于 2012-9-28 00:43:50

你把错误关掉吧
或者所有异常都跳404

levin 发表于 2012-9-28 14:40:32

index.php里define('ENVIRONMENT', 'development');改成define('ENVIRONMENT', 'production');即可
自己都把代码贴出来了,你都不看代码的吗
页: [1]
查看完整版本: 关于CI错误