在create()时出现“非法数据对象”错误!

浏览:2078 发布日期:2013/06/22 分类:求助交流
$Input=D('UserIndexInput');
if(!$Input->create($_REQUEST))
$this->error($Input->getError());
class UserIndexInputModel extends Model{
    protected $autoCheckFields=false;
    
    protected $_auto=array(
        array('keyword', 'autoKeyword', 3, 'callback'),
        array('page', 'autoPage', 3, 'callback'),
        array('pageRecords', 'autoPageRecords', 3, 'callback'),
    );
    
    protected function autoKeyword(){
        if(!Think::validate('/^\w{0,16}$/'))
            return "";
        return $_REQUEST['keyword'];
    }
    
    protected function autoPage(){
        if(empty($_REQUEST['page']) || $_REQUEST['page']<1)
            return '1';
        return $_REQUEST['page'];
    }
    
    protected function autoPageRecords(){
        if($_REQUEST['pageRecords']>=1 && $_REQUEST['pageRecords']<=1024)
            return $_REQUEST['pageRecords'];
        if($_REQUEST['pageRecords']>1024)
            return '1024';
        return '20';
    }
}
?>
最佳答案
评论() 相关
后面还有条评论,点击查看>>