php 如何调用帮助类 magento
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8265819/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to call a helper class magento
提问by Daric
I am trying to call a helper class in magento but stuck with an error message from magento.
我正在尝试在 magento 中调用帮助程序类,但遇到了来自 magento 的错误消息。
The helper class is located at
助手类位于
app/code/core/Mage/Catalog/Helper/Product/Compare.php
app/code/core/Mage/Catalog/Helper/Product/Compare.php
The class name is
班级名称是
class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
I tried the below call
我试过下面的电话
$helper=Mage::helper('catalog_product_compare');
Error message I got
我收到的错误信息
Fatal error: Class 'Mage_Catalog_Product_Compare_Helper_Data' not found in C:\xampp\htdocs
致命错误:在 C:\xampp\htdocs 中找不到“Mage_Catalog_Product_Compare_Helper_Data”类
How can i call this helper class?
我怎么称呼这个助手类?
回答by Jürgen Thelen
Like this:
像这样:
$helper = Mage::helper('catalog/product_compare');