model.class
18-1-4 16:59:47
<?
namespace Home\Model;
use Think\Model;
class InfoModel extends Model {
//protected $tablePrefix = 'top_'; //表前缀
//protected $tableName = 'categories'; //表名字
//protected $trueTableName = 'top_categories'; //完整表名
//protected $dbName = 'top'; //数据库
//protected $patchValidate = true; //批量验证
/* protected $_map = array(//表单映射
'name' =>'title', // 把表单中name映射到数据表的username字段
'mail' =>'content', // 把表单中的mail映射到数据表的email字段
);*/
protected $_scope = array(//组合命令
// 命名范围abc
'abc'=>array(
'where'=>array('title'=>'h'),
'limit'=>3,
),
// 命名范围aaa
'aaa'=>array(
'order'=>'id DESC',
'limit'=>3,
),
);
//数据验证
protected $_validate = array(
array('title','require','title.....'), //字段,规则,提示,条件0,1,2,附加规则
array('content','require','content.....'), // 在新增的时候验证name字段是否
);
}