Home > Backend Development > PHP Tutorial > thinkphp $model_user->create($data)数据格式不对解决思路

thinkphp $model_user->create($data)数据格式不对解决思路

WBOY
Release: 2016-06-13 11:46:14
Original
1036 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