<?php
class PI_Controller_Plugin_AssetGrabber extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
/*
The module name
*/
$moduleName = $request->getModuleName();
/*
This modules requires the user to be loggedin in order to see the web pages!
*/
$loginRequiredModules = array('admin');
if (in_array($moduleName,$loginRequiredModules)) {
$adminLogin = new Zend_Session_Namespace('adminLogin');
if (!isset($adminLogin->loggedin)) {
/*--------------------------------------
Here I want to redirect the user
*/
$this->_redirect('/something');
}
}
}
}
Я пытаюсь сделать перенаправление $this->_redirect('/something')
, но не работает! Вы знаете, как я могу сделать переадресацию в этом случае?Zend Framework url redirect
С наилучшими пожеланиями,
Что сообщение об ошибке? Ничего? Просто не перенаправлять? Вы можете попробовать $ this -> _ helper-> redirector() тоже, или $ this -> _ helper-> gotoUrl() подробнее см. В http://framework.zend.com/manual/en/zend.controller.actionhelpers.html # zend.controller.actionhelper.redirector.basicusage. –
Я не могу использовать эти вещи в своем плагине, потому что вы можете ТОЛЬКО использовать '$ this -> _ redirect' .. только если вы расширяете Zend_Controller_Action – Uffo