src/Foundation/Request.php
public function getByRule($rule)
    {
        $rs = null;

        if (!isset($rule['name'])) {
            throw new InternalServerError(T('miss name for rule'));
        }

        $rs = Variable::format($rule['name'], $rule, $this->data);

        if ($rs === NULL && (isset($rule['require']) && $rule['require'])) {
            throw new BadRequest(T('{name} require, but miss', ['name' => $rule['name']]));
        }

        return $rs;
    }
public function getByRule($rule)
    {
        $rs = null;

        if (!isset($rule['name'])) {
            throw new InternalServerError(T('miss name for rule'));
        }

        $rs = Variable::format($rule['name'], $rule, $this->data);

        if ($rs === NULL && (isset($rule['require']) && $rule['require'])) {
            throw new BadRequest(T('{name} require, but miss', ['name' => $rule['name']]));
        }

        return $rs;
    }
public function getByRule ( $ rule ) { $ rs = null ; if ( ! isset ( $ rule [ 'name' ] ) ) { throw new InternalServerError ( T ( 'miss name for rule' ) ) ; } $ rs = Variable :: format ( $ rule [ 'name' ] , $ rule , $ this -> data ) ; if ( $ rs === NULL && ( isset ( $ rule [ 'require' ] ) && $ rule [ 'require' ] ) ) { throw new BadRequest ( T ( '{name} require, but miss' , [ 'name' => $ rule [ 'name' ] ] ) ) ; } return $ rs ; }
根据规则获取参数

@param array $rule 参数规则
@throws InternalServerError
@throws BadRequest
@return mixed
根据规则获取参数