Maximum execution time of 30 seconds exceeded

来源:互联网 发布:sql中给表起别名 编辑:程序博客网 时间:2024/06/04 18:25

错误位置

FILE: C:\xampp\htdocs\passwordSwitch\ThinkPHP\Library\Think\Db\Driver.class.php LINE: 223

    public function dataWrite(){        echo "<hr>正在写入...<hr>";        $cto = new CtoModel();       // $data['id'] = '3';        $data['username'] = '空空dream';        for ($i=530;$i<55530;$i++){            $email = 'lglgl'.$i.'@163.com';        $data['email'] = $email;        $data['password'] = '10086';                $cto->data($data)->add();        echo "<hr>".$email."写入完成<hr>";        }

xamp环境,此错误字面上理解是“最大执行时间超过30秒”;

故障出处:一次性往数据库写入5W条数据产生的错误.

由于Apache PHP默认设置的 max_execution_time 为30秒,而一次性往数据库写入5W条数据的时间超出了30秒,故产生次错误.


解决办法:在PHP.INI中找到max_execution_time参数,设置为您认为的最大数值即可.

参考:http://blog.sina.com.cn/s/blog_70b166010100uk73.html

0 0