0
Mage :: helper('core') - >的magento 2等价物是什么?Mage :: helper('core') - >的magento 2等价物是什么?
Mage :: helper('core') - >的magento 2等价物是什么?Mage :: helper('core') - >的magento 2等价物是什么?
的Mage
静态方法不存在了,你将不得不使用依赖注入来获得你的助手实例,例如在你的模型:
<?php
namespace Mycompany\Mymodule\Model;
use Mycompany\Mymodule\Helper\Data;
class Custom {
private $helper;
public function __construct(
Data $helper
) {
$this->helper = $helper;
}
public function myMethod() {
$this->helper->helperMethod();
}
}
您可以使用块等同一系统..并为现有的助手,你想使用。