【发布时间】:2012-03-30 00:34:00
【问题描述】:
<?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'),但不起作用!你知道在这种情况下我该如何做重定向吗?
最好的问候,
【问题讨论】:
-
错误信息是什么?没有什么?根本不重定向?你也可以试试 $this->_helper->redirector() ,或者 $this->_helper->gotoUrl() 在framework.zend.com/manual/en/… 上查看更多信息。
-
我不能在我的插件中使用这些东西,因为你只能使用
$this->_redirect..只有在你扩展 Zend_Controller_Action 时才能使用
标签: php zend-framework