gpt4 book ai didi

Magento Controller 路由正在路由到 Controller 的noRouteAction

转载 作者:行者123 更新时间:2023-12-02 15:32:23 24 4
gpt4 key购买 nike

我正在构建一个 Controller ,当我调用一个操作时,我收到 404 错误(上周一切正常!)。我使用以下方式调用该操作:

http://www.website.com/route/controllername/actionname

例如:

http://www.website.com/abcdef/test/echo

我已经调查了这个问题(使用 Mage::log('..'))并发现 Controller 正在加载。 Controller 的名字也很好。进一步调查显示,我的 Controller 中的 noRouteAction 正在被调用。

即我的 Controller 包含:

public function noRouteAction() {
echo "noRoute Action";
}

public function echoAction() {
echo "Echo Action";
}

当我打电话http://www.website.com/abcdef/test/echo时我收到“noRoute Action”。

为什么没有调用 echoAction?

<小时/>

编辑:

config.xml

<?xml version="1.0"?>
<config>
<modules>
<Abcdef_Web>
<version>1.0.0</version>
</Abcdef_Web>
</modules>
<global>
<helpers>
<abcdef>
<class>Abcdef_Web_Helper</class>
</abcdef>
</helpers>
<blocks>
<abcdef>
<class>Abcdef_Web_Block</class>
</abcdef>
</blocks>
</global>
<frontend>
<routers>
<abcdef>
<use>standard</use>
<args>
<module>Abcdef_Web</module>
<frontName>abcdef</frontName>
</args>
</abcdef>
</routers>
<layout>
<updates>
<abcdef>
<file>abcdef.xml</file>
</abcdef>
</updates>
</layout>
</frontend>

</config>

Controller 类文件:(TestController.php)

<?php

class Abcdef_Web_TestController extends Mage_Core_Controller_Front_Action {

public function noRouteAction() {
echo "noRoute Action";
}

public function echoAction() {
echo "Echo Action";
}

}

?>

最佳答案

好的,找到问题了!!!!

似乎“将商店代码添加到 URL”设置为"is",因此 Magento 期望:

http://www.website.com/storecode/abcdef/test/echo

而不是:

http://www.website.com/abcdef/test/echo

对于有同样问题的人。可以通过以下方式禁用此功能:

系统/配置/常规/Web/网址选项/将商店代码添加到网址

注意:

我不记得将此选项设置为"is"。我看到一些报告称此设置可能会自动更改(4 人报告):

http://www.magentocommerce.com/boards/viewthread/192613/

关于Magento Controller 路由正在路由到 Controller 的noRouteAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7792887/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com