#1 eoneliu
我想编写一个验证用户是否存在的验证规则。。但是不知道该怎么写。请大家帮忙指点指点class Users extends spModle{
var $addrules = array(
'is_exists' => 'exists', // '规则名称' => '验证函数名'
);
var $verifier = array(
"rules" => array(
'username' => array(
'is_exists' => 'exists', //还是 'is_exists' => true,
)
}
//modle 中 的 独立函数。
function exists($val, $right){
$conditions = array('username' => $val);
if ($this -> findBy($conditions)){ //或是 findCount($conditions);
return true;
}else{
return false;
}
}
===========================================
还有第二个问题。
如果表单提交出差。我想讲用户提交信息在 回显。
难道只能 是
$this -> username = $this -> spArgs('username');
$this -> age = $this -> spArgs('age');
.....
smarty 可以直接显示数组。咱们有啥简便的方法没? 还有个疑问。为啥每个 文件都 没有php的 结束标示呢?
2010-05-10 11:34:04