Yii2 PHP 手册阅读记录

18 Dec 2015 Category: PHP

The action methods for inline actions and the run() methods for standalone actions can take parameters, called action parameters. Their values are obtained from requests. For Web applications, the value of each action parameter is retrieved from $_GET using the parameter name as the key; for console applications, they correspond to the command line arguments.

If you want an action parameter to accept array values, you should type-hint it with array

public function actionView(array $id, $version = null)
{
    // ...
}

评论