用户注册失败
时间:2011-12-20
来源:互联网
$insertModel=D("user");
$insertModel->create();
$insertend=$insertModel->add();
if ($insertend)
$this->redirect('index',array('cate_id'=>2),1,'注册成功,页面跳转中');
else throw_exception("注册失败"); 在action中用这个方法,为什么注册后一直是注册失败;数据库中也没有显示出来。。
$insertModel->create();
$insertend=$insertModel->add();
if ($insertend)
$this->redirect('index',array('cate_id'=>2),1,'注册成功,页面跳转中');
else throw_exception("注册失败"); 在action中用这个方法,为什么注册后一直是注册失败;数据库中也没有显示出来。。
作者: man123 发布时间: 2011-12-20
这个表单中的input 字段,也就是post过去的字段,一定要跟数据库中的字段,对应起来。
如果你觉得有安全方面的隐患的话,你就要重新组织一下传入的数据,比如$array=array('user'=>'test','content'='test is work');
$insertModel->create($array);
$insertend=$insertModel->add();
后面的就一样了。
其实还可以打印出sql语句来看看是哪里出问题了。
$insertModel->getLastSql();
这样两点解决了,基本上你注册也就成功了。
如果你觉得有安全方面的隐患的话,你就要重新组织一下传入的数据,比如$array=array('user'=>'test','content'='test is work');
$insertModel->create($array);
$insertend=$insertModel->add();
后面的就一样了。
其实还可以打印出sql语句来看看是哪里出问题了。
$insertModel->getLastSql();
这样两点解决了,基本上你注册也就成功了。
作者: php-fish 发布时间: 2011-12-20
www.cj03.com学习一下!
作者: a871022 发布时间: 2011-12-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28