thinkphp $model_user->create($data)数据格式不对,该如何解决

WBOY
Release: 2016-06-13 12:54:29
Original
1022 people have browsed it

thinkphp $model_user->create($data)数据格式不对
 protected $_validate = array(
        array('name','require','用户名不能为空'),
        array('passwd','require','密码不能为空')        
    );
 
function login() {
        $model_user = D("User");
        $data = array(
              'name' => $this->_post('name'),
              'passwd' => $this->_post('passwd')       
            );
        if (!$model_user->create($data)){
            $this->error($model_user->getError(),U('uc/login'));
        }else {
        }
如题 ,我想做个登录自动验证,怎么也不好使  求高手解答


------解决方案--------------------
LZ是不是改了数据表结构,清理一下缓存试下。如果不行的话, 把getError信息贴出来。
------解决方案--------------------
……登录为什么要create($data)……不是where($data)->select()?
------解决方案--------------------
引用:
……登录为什么要create($data)……不是where($data)->select()?

tp在create的时候会进行三大自动
------解决方案--------------------
CREATE好像是不用$data的
------解决方案--------------------
你看看create()方法
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!