本文整理汇总了PHP中Magento\Framework\App\Request\Http::isPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::isPost方法的具体用法?PHP Http::isPost怎么用?PHP Http::isPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Request\Http
的用法示例。
在下文中一共展示了Http::isPost方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterDispatch
/**
* Set Cookie for msg box when it displays first
*
* @param \Magento\Framework\App\FrontController $subject
* @param \Magento\Framework\App\ResponseInterface $response
*
* @return \Magento\Framework\App\ResponseInterface
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterDispatch(\Magento\Framework\App\FrontController $subject, \Magento\Framework\App\ResponseInterface $response)
{
if ($this->request->isPost() && $this->messageManager->hasMessages()) {
$this->cookie->set(self::COOKIE_NAME, 1, self::COOKIE_PERIOD, '/');
}
return $response;
}
示例2: process
/**
* Handle private content version cookie
* Set cookie if it is not set.
* Increment version on post requests.
* In all other cases do nothing.
*
* @return void
*/
public function process()
{
if ($this->request->isPost()) {
$publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setDuration(self::COOKIE_PERIOD)->setPath('/')->setHttpOnly(false);
$this->cookieManager->setPublicCookie(self::COOKIE_NAME, $this->generateValue(), $publicCookieMetadata);
}
}
示例3: afterDispatch
/**
* Set Cookie for msg box when it displays first
*
* @param FrontController $subject
* @param \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface $result
*
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterDispatch(FrontController $subject, $result)
{
if ($this->request->isPost() && $this->messageManager->hasMessages()) {
$publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setDuration(self::COOKIE_PERIOD)->setPath('/')->setHttpOnly(false);
$this->cookieManager->setPublicCookie(self::COOKIE_NAME, 1, $publicCookieMetadata);
}
return $result;
}
示例4: process
/**
* Handle private content version cookie
* Set cookie if it is not set.
* Increment version on post requests.
* In all other cases do nothing.
*
* @return void
*/
public function process()
{
if ($this->request->isPost()) {
$this->cookie->set(self::COOKIE_NAME, $this->generateValue(), self::COOKIE_PERIOD, '/');
}
}
示例5: consumeNotification
/**
* @inheritdoc
*/
public function consumeNotification(\Magento\Framework\App\Request\Http $request)
{
if (!$request->isPost()) {
throw new LocalizedException(new Phrase('POST request is required.'));
}
$response = $this->methodCaller->call('orderConsumeNotification', [$request->getContent()]);
if ($response) {
return ['payuplOrderId' => $response->order->orderId, 'status' => $response->order->status, 'amount' => (double) $response->order->totalAmount / 100];
}
return false;
}