(controller) query of routing configuration item in Yii2

the document address is ide/2.0/zh-cn/rest-routing-sharplu-you" rel=" nofollow noreferrer "> https://www.yiiframework.com/.

does not understand the controller configuration here. My first reaction was to name user u , but I visited http://xxx.com/u could not access (404)
so how to understand this configuration?

Mar.10,2021

personal test is feasible, maybe you have the wrong configuration.

  • configuration file
'urlManager' => [
    'enablePrettyUrl'       => true,
    'enableStrictParsing'   => true,
    'showScriptName'        => false,
    'rules' => [
        -sharp 
        ['class' => 'yii\rest\UrlRule', 'controller' => [ 'u'=> 'user']],
    ],
],
  • controller
use api\components\rest\Controller;

class UserController extends Controller
{
    public function actionIndex()
    {
        return [
            'code' => 0,
            'message' => 'success',
        ];
    }
}
{
    "code": 0,
    "message": "success"
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b88e-4e70c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b88e-4e70c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?