+ -
当前位置:首页 → 问答吧 → 用户注册失败

用户注册失败

时间: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中用这个方法,为什么注册后一直是注册失败;数据库中也没有显示出来。。

作者: man123   发布时间: 2011-12-20

这个表单中的input 字段,也就是post过去的字段,一定要跟数据库中的字段,对应起来。

如果你觉得有安全方面的隐患的话,你就要重新组织一下传入的数据,比如$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

热门下载

更多