为什么add()时字段值是空的?

浏览:776 发布日期:2015/06/26 分类:求助交流
表单提交,create自动验证后add,数据库表里多了一行,但这行的各字段值都是空的,输出_sql()显示:INS ERT INT O ‘users’ () VAL UES ()什么情况下会出现这样的结果?

IndexController.class.php:        public function regopinion(){
            $Data = D('users');
            if ($Data->create(I('post.'), 1)){
                // 验证通过 可以进行其他数据操作
                $result = $Data->add();
            } else {
            }
        }
UsersModel.class.php:    class UsersModel extends Model {
        // 定义自动验证
        protected $tableName = 'users';
        protected $_validate = array(
                                     //注册时验证
                                     array('uphone', 'isMobile', 'wrong phone type', 1, 'callback', 1)
                                     //array('uphone', '', 'used phone', 0, 'unique', 1)
                                     );
            // 定义自动完成
        protected $_auto = array(
                                 array('upassword', 'deRsa_hash', 1, 'callback')
                                 );
自动验证通过了,数据库表也多了一行,但uphone和upassword字段是空的。为什么?
另外如果去掉//array('uphone', '', 'used phone', 0, 'unique', 1)的//,又错误提示used phone,可数据库中并没有相同的uphone值,又是为何?
最佳答案
评论() 相关
后面还有条评论,点击查看>>