【问题标题】:Redirect to Magento admin dashboard重定向到 Magento 管理仪表板
【发布时间】:2013-07-10 18:15:37
【问题描述】:

我在互联网上搜索了这个问题的答案,但一无所获。我有一个自定义扩展。其中一项功能会将用户重定向到管理仪表板。如何做到这一点?

我尝试过类似的东西

$this->_redirect("/")
$this->_redirect("*")
$this->_redirect("*/*")

但没有任何效果。

【问题讨论】:

  • 针对我的具体情况的一种解决方法是重定向到引用者,使用 $this->_redirectReferer();

标签: magento


【解决方案1】:

如果您处于控制器操作中,则可以使用以下内容:

<?php $this->_redirect('adminhtml/dashboard') ?>

如果您在 Adminhtml 控制器操作中,您可以使用:

<?php echo $this->_redirect('*/dashboard') ?>

这是因为 Adminhtml 是当前模块。

【讨论】:

    【解决方案2】:

    在你的控制器结束时:

    Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl('/'));
    

    但这正是我脑海中闪过的想法……当然还有其他几种方法可以实现这一目标。像往常一样...

    【讨论】:

      猜你喜欢
      • 2022-01-23
      • 2021-01-09
      • 1970-01-01
      • 2020-05-19
      • 1970-01-01
      • 1970-01-01
      • 2020-02-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多