### 自动完成
自动完成是在模型层对数据进行自动处理的操作过程。
注:必须执行 create 或 auto 模型方法,才会执行自动完成
自动完成语法
~~~
array(' 表单字段名 ',' 处理方法 ',' 方法类型 ',' 验证条件 ',' 处理时机 ')
~~~
| 参数 | 说明 |
| -- | -- |
| 表单字段名 | 字段名 |
| 方法名 | 方法或函数 |
| 执行方式 | method 模型方法 ; function 函数 ; string 具体值 |
| 处理条件 | 1 存在字段时 ; 2 必须处理 ; 3 值不为空时 ; 4 值为空时 |
| 处理时机 | 1 插入时 ; 2 更新时 ; 3 插入与更新 |
使用示例
~~~
class UserModel extends Model
{
public $auto=array(
//addtime 字段执行 strtotime 函数
array('addtime','strtotime','function',2,3),
// 插入时设置 click 值为 100
array('click',100,'string',2,1)
);
}
~~~