代码如下:
$rs=$mr->add($dd);
if($rs){
$r["status"]="1";
$r["data"]["uid"]=$rs;
}else{
$r["status"]="0";
$r["error"]="注册失败";
}修改方法:在文件:/ThinkPHP\Library\Think\Db\Driver.class.php 里的execute方法:
把:$result = $this->PDOStatement->execute();
改成:
try{
$result = $this->PDOStatement->execute();
}catch(\PDOException $e){
return false;
}
就可以了。
原因是数据库查询报错,tp捕获到这个错误,然后再直接输出404。
再然后我们新增加一个配置项来控制是否启用它.
最佳答案