yii\web\Request::get PHP Method

get() public method

Returns GET parameter with a given name. If name isn't specified, returns an array of all GET parameters.
public get ( string $name = null, mixed $defaultValue = null ) : array | mixed
$name string the parameter name
$defaultValue mixed the default parameter value if the parameter does not exist.
return array | mixed
    public function get($name = null, $defaultValue = null)
    {
        if ($name === null) {
            return $this->getQueryParams();
        } else {
            return $this->getQueryParam($name, $defaultValue);
        }
    }

Usage Example

Example #1
0
 /**
  * @param \yii\web\Request $request
  * @return integer|null
  */
 private function getNoteAuthorId($request)
 {
     $noteId = $request->get('id');
     /** @var $note Note|null */
     $note = Note::findOne($noteId);
     return isset($note) ? $note->author_id : null;
 }
All Usage Examples Of yii\web\Request::get