Yii2 REST API PUT作为模块路由配置404

时间:2018-07-22 15:48:12

标签: rest yii2-advanced-app

我的配置

'modules' => [
    'admin' => [
        'class' => 'backend\modules\admin\Module',
    ],
],

'urlManager' => [
        'enablePrettyUrl' => true,
        'enableStrictParsing' => false,
        'showScriptName' => false,
        'rules' => include __DIR__ . '/route.php',
    ],

route.php

return [
[
    'class'      => 'yii\rest\UrlRule',
    'controller' => [
        'admin/user',
        'admin/route',
        'admin/rule',
    ],
    'extraPatterns' => [
        'PUT update/<id:\d+>' => 'update',
    ],
    'pluralize' => false,
],

当PUT路由admin / rule / update / 1休止404时

web / urlRUle var_dump($ this-> pattern)是'#^ admin / rule / update /(?P \ d +)$#u'

请帮助我,谢谢。

0 个答案:

没有答案