在redirect()中传递数据-Typo3 [英] Pass data in redirect() - Typo3

查看:94
本文介绍了在redirect()中传递数据-Typo3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

验证后我有一个表格,如果发生任何错误,页面将被重定向到带有错误消息的编辑本身.如何通过typo3中的redirect()传递先前的数据和错误消息?

I have a form after validation if any error occur the page will redirected to the edit itself with an error message.How to pass previous data and an error message through redirect() in typo3 ?

$this->redirect($action_name,$controllername, $extensionName, array('data',$data));

对吗?

我的动作名称是'edit',但已重定向到'list'.请帮助我解决此问题.

my action name is 'edit' But it is redirect to 'list' .Please help me to solve this issue.

推荐答案

传递给重定向目标的参数必须以关联数组的形式给出.关键是参数名称(如在actions方法标题中一样,不带$),该值是参数值.看起来像这样:

The arguments to pass to the redirect-target have to be given as associative array. The key is the argument name (as in the actions method header, without the $), the value is the argument value. Looks like this:

$this->redirect(
    $action_name,
    $controllername,
    $extensionName,
    [
        'data' => $data
    ]
);

$data在URL中的确切编码方式取决于其类型.持久对象被编码为其ID,标量被编码为简单字符串.它们如何到达其他动作取决于该动作的类型提示和@param注释.

How exactly $data is encoded in the URL depends on its type. Persistent objects are encoded as their ID, scalars are encoded as simple strings. How they arrive in the other action depends on that actions typehints and @param annotations.

要重定向到相同的控制器或扩展,可以将$controllerName$extensionName作为null传递.

To redirect to the same controller or extension, you can pass $controllerNameand $extensionName as null.

这篇关于在redirect()中传递数据-Typo3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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