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

查看:75
本文介绍了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天全站免登陆