RegisterModel::isValidPhone PHP Метод

isValidPhone() публичный Метод

}
public isValidPhone ( $phone, $old_phone = null )
    public function isValidPhone($phone, $old_phone = null)
    {
        $res = preg_match($this->_phone_reg, $phone, $matches) !== 0;
        if (!$res) {
            $this->_error = '无效的手机号';
        }
        if ($res && $this->_user_model->where('`phone`="' . mysql_escape_string($phone) . '"')->find() and $phone != $old_phone) {
            $this->_error = '该手机号已被注册';
            $res = false;
        }
        return (bool) $res;
    }