我試圖在某些情況下實現「登錄重定向」,就像我的網站上只有一個頁面只用於登錄用戶。ZF2:傳遞重定向url作爲參數
截至目前,訪客用戶轉到該頁面時,訪客被重定向到登錄頁面,我希望用戶在登錄後在同一頁面上重定向。
我的登錄模塊是:http://samsonasik.wordpress.com/2012/10/23/zend-framework-2-create-login-authentication-using-authenticationservice-with-rememberme/ 並已將此代碼集成到「application/auth」控制器中。
當我使用這個網址: www.qa-staging.com/hemaa/auth/login/redirect/http%3A%2F%2Fgoogle.com
它給了我一個404錯誤。
使用時: www.qa-staging.com/hemaa/auth/login/redirect/ http://google.com然後路由的作品,但我認爲是不是一個好的做法,以實現這一目標。
控制器:AUTH
行動:登錄
參數1:重定向
參數2:URL重定向
'noModule' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller][/:action[/:param1[/:param2[/:param3]]]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[a-zA-Z0-9_-]*',
'param2' => '(.)+',
'param3' => '(.)+',
),
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
),
不知道如何可以做到這一點?
謝謝@Wilt。有用。 – user2794408