Joomla setRedirect 不起作用 [英] Joomla setRedirect doesn't work

查看:12
本文介绍了Joomla setRedirect 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 Joomla 控制器,但我无法重定向任何东西.

I have a simple Joomla controller, but I can't redirect anything.

根据文档:

class MyController extends MyBaseController {

 function import() {
    $link = JRoute::_('index.php?option=com_foo&ctrl=bar');
    $this->setRedirect($link);
  }

}
//The url contains & html escaped character instead of "&"

这应该可行,但我收到一个格式错误的 URL.有什么我在这里想念的吗?为什么 Joomla 会转换所有的&"& 的字符?我应该如何使用 setRedirect?

This should work, but I get a malformed URL. Is there something I'm missing here? Why is Joomla converting all the "&" characters into &'s? How am I suppose to use setRedirect?

谢谢

推荐答案

好的,我修好了.所以如果有人需要它:

Alright, I fixed it. So if anyone needs it:

代替

$link = JRoute::_('index.php?option=com_foo&ctrl=bar');
$this->setRedirect($link);

使用

$link = JRoute::_('index.php?option=com_foo&ctrl=bar',false);
$this->setRedirect($link);

让它发挥作用.

这篇关于Joomla setRedirect 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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