ZfcUser注册后重定向到我选择的页面 [英] ZfcUser Redirect to page of my choice after Registration

查看:118
本文介绍了ZfcUser注册后重定向到我选择的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在zfcuser注册后,我一直试图重定向到我选择的页面/路由.当前,它重定向到登录页面.

I have been trying to redirect to a page/route of my choice after zfcuser registration. Currently it redirects to the login page.

我现在可以在使用recaptcha而不是figlet的init事件上进行更改.

I was able to make changes on the init event where I am now using the recaptcha instead of figlet.

我在zfcuser的register事件的模块的bootstrap方法上添加了一个侦听器.但是不确定以后该怎么做,以便用户注册后可以重定向到我选择的页面.任何帮助将不胜感激,因为它也将帮助我充分了解zf2.

I have added a listener on my module's bootstrap method on zfcuser's register event. But not sure what to do afterwards so that I can redirect to a page of my choice after user registers. Any help would be much appreciated as it would also help me alot on my basic understanding of zf2.

这是我在zfcuser注册事件上的模块类上的引导代码(这里没有什么):

Here is my bootstrap code (nothing much there) on my module class on zfcuser register event:

$zfcServiceEvents = $e->getApplication()->getServiceManager()->get('zfcuser_user_service')->getEventManager();
$zfcServiceEvents->attach('register', function($e) use ($app) {

// ...............

});

推荐答案

您将不得不从该侦听器返回一个Response -Object.每当存在类型为Response的返回对象时,应用程序工作流程就会停止,并返回Response.

You will have to return a Response-Object from that listener. Whenever there is a return Object of type Response, then the application workflow stops and the Response is returned.

您想要做的是创建一个Response -Object,为其提供状态重定向,并添加用于重定向的标头;)

What you wanna be doing is to create said Response-Object, give it the status redirect and add the header for redirection ;)

这篇关于ZfcUser注册后重定向到我选择的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆