3
我无法使用http请求获取从post方法发送的值。在magento 2 api中使用post方法在控制器中获取值发送
我使用get方法获取值,但我需要使用post方法获取它。
我没有使用任何视图,我想调用http url,并使用post方法在我的控制器中发送一些数据。
这是我的控制器看起来像,
namespace Spaarg\eMenuApi\Controller\Index;
class Products extends \Magento\Framework\App\Action\Action
{
public function __construct(\Magento\Framework\App\Action\Context $context)
{
return parent::__construct($context);
}
public function execute()
{
//$token = $this->getRequest()->getPostValue();
$token = $this->getRequest()->getPost();
}
}
我是新来的Magento 2,我不明白是什么问题。 如果有人能帮忙,这将会很棒。