1)报错信息:
FILE: /var/www/html/ThinkPHP/Library/Think/Db/Driver.class.php LINE: 224
TRACE
#0 /var/www/html/ThinkPHP/Library/Think/Db/Driver.class.php(224): PDOStatement->execute()
#1 /var/www/html/ThinkPHP/Library/Think/Db/Driver.class.php(815): Think\Db\Driver->execute('INSERT INTO `os...', false)
#2 /var/www/html/ThinkPHP/Library/Think/Model.class.php(320): Think\Db\Driver->insert(Array, Array, false)
#3 /var/www/html/Modules/Home/Model/FrontorderModel.class.php(515): Think\Model->add(Array)
#4 /var/www/html/Modules/Home/Controller/CarController.class.php(4577): Home\Model\FrontorderModel->addOrder(Array)
#5 [internal function]: Home\Controller\CarController->sub_order()
#6 /var/www/html/ThinkPHP/Library/Think/App.class.php(167): ReflectionMethod->invoke(Object(Home\Controller\CarController))
#7 /var/www/html/ThinkPHP/Library/Think/App.class.php(205): Think\App::exec()
#8 /var/www/html/ThinkPHP/Library/Think/Think.class.php(120): Think\App::run()
#9 /var/www/html/ThinkPHP/ThinkPHP.php(97): Think\Think::start()
#10 /var/www/html/wxapp.php(25): require('/var/www/html/T...')
2)运行环境:
CentOS7 + php5.6 + mysql5.6
3)错误分析:
xxxx没有默认值;
MYSQL配置文件/etc/my.cnf内(默认这个路径,找不到就:whereis my.cnf),
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
严格验证模式
4)解决方案:
注释掉上述模式:
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
修改为:
sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
最后保存退出。
执行:
systemctl stop httpd
service mysqld restart(或systemctl restart mysqld.service)
systemctl start httpd