****警告:/var/www/html/magento2/app/code/Custom/HelloWord/Controller/Hello/Event.php 中的未定义变量 $item ** **`
<?php
namespace Custom\HelloWord\Controller\Hello;
class Event extends \Magento\Framework\App\Action\Action
{
public function execute()
{
$textDisplay = new \Magento\Framework\DataObject(array('text' => 'Custom'));
$this->_eventManager->dispatch('sales_quote_remove_item', ['quote_item' => $item]);
echo $textDisplay->getText();
exit;
}
}`