我有一个正在运行的ZF2应用程序,其中zfcUser用于身份验证。在应用程序引导程序中,如果未进行身份验证,则会将用户重定向到登录屏幕。 现在我想在应用程序中添加一个Rest Api,它将通过api.domain.tld访问。因此,我创建了一个包含以下路径的新模块:
'router' => array(
'routes' => array(
'api.domain.local' => array(
'type' => 'Zend\Mvc\Router\Http\Hostname',
'options' => array(
'route' => ':3rd.:2nd.:1st',
'contraints' => array(
'3rd' => 'api',
'2nd' => 'domain',
'1st' => '.*?', // is valid for .local and .com ),
// Purposely omit default controller and action
// to let the child routes control the route match
),
'child_routes' => array(
'index' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/index',
'defaults' => array(
'controller' => 'Rest\Controller\Index',
'action' => 'index',
),
),
'may_terminate' => TRUE,
),
),
),
),
),
如何在调用api.domain.tld时避免登录界面?