0
我遵循本教程:http://ivangospodinow.com/zend-framework-2-acl-setup-in-5-minutes-tutorial/ 但是,我想通過自定義URL授予權限,所以我在代碼中進行了一些更改。通過Zend Framework中的URL授予ACL許可2
在module.acl.roles.php
return array(
'guest'=> array(
'/home.html',
'/login.html',
'/register.html'
),
'admin'=> array(
'/user/add.html',
'/user/edit.html',
'/user/list.html',
),
);
在module.config.php
return array(
'router' => array(
'routes' => array(
'/home.html' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'index',
),
),
),
'/user/add.html' => array(
'type' => 'Zend\Mvc\Router\Http\Regex',
'options' => array(
'regex' => '/user/add.html',
'defaults' => array(
'controller' => 'Application\Controller\User',
'action' => 'add',
'format' => 'html',
),
'spec' => '/user/add.%format%',
),
),
...
),
),
);
但我收到此錯誤:Route with name "" not found
。請給我一些建議和解決方案,授予URL的許可
謝謝!
我建議你看看https://github.com/bjyoungblood/BjyAuthorize相反,即路線守衛 – Xerkus