magento显示请求url
我想显示模块,控制器,被调用的方法
我认为cms模块在
应用\代码\核心\Mage\cms\
调用 IndexController.php 并使用 IndexAction 方法。因为它是默认页面 url。
但是当我尝试在 IndexAction 方法中回显某些内容时,什么也没有出现。我什至尝试手动调用它,它仍然重定向到主页。
本地主机/magento/index.php/cms/index/index/
我做对了吗? 我怎样才能显示在magento中调用的请求url?
i wanted to display the module,controller,method being called
i thought that the cms module found in the
app\code\core\Mage\cms\
calls the IndexController.php and uses the IndexAction method .since it is the default page url.
but when I tried to echo out something inside the IndexAction method .nothing comes out. I even tried to call it manually and it still redirects to the home page.
localhost/magento/index.php/cms/index/index/
am i doing it right?
how can i display the request url being called in magento?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我也在找这个,具体方法如下:
I was looking for this also, here's how to do it:
您好,您可以尝试输出以下内容
未经测试,但也许您可以执行类似的操作
希望这有
帮助
Hi you could try to output the following
Not tested but maybe you can do something like this
Hope this helps
greetings
我需要 URL 段,所以我使用了这个:
I needed the URL segments, so I used this:
您可能会使用控制器中的回显在日志文件中收到“标头已发送”警告。不要使用 echo,而是使用 Mage::log,例如
日志行应出现在 /var/logs/system.log 文件中。
You might be getting 'headers already sent' warnings in your log files using an echo in the controller. Instead of using echo use Mage::log, e.g.
The log line should appear in the /var/logs/system.log file.
路由
cms/index/index
仅用于主页。其他标准页面(例如“no-route”和“enable-cookies”)可以选择通过 IndexController 上的特定操作进行处理。其余页面由Mage_Cms_PageController::viewAction()
处理。尝试路径 cms/page/view/id/customer-service< /a> 看看。该参数是id
,因此下一个术语customer-service
是您在管理中设置为“URL Key”的页面标识符。The route
cms/index/index
is only ever used for the home page. Other standard pages like "no-route" and "enable-cookies" are optionally handled by specific actions on the IndexController. The remaining pages are handled byMage_Cms_PageController::viewAction()
instead. Try the path cms/page/view/id/customer-service to see. The parameter isid
and so the next termcustomer-service
is the page identifier which you set in the admin as "URL Key".