{ Hello Magento 2 }

解决 Magento 2 应用问题,更注重深度挖掘。(ง •̀_•́)ง

0%

magento 2 redirect url

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace VendorName\ModuleName\Controller\Index;

class Index extends \Magento\Framework\App\Action\Action {

/**
*
* @return \Magento\Framework\Controller\Result\Redirect
*/
public function execute() {

$url = 'http://hellomagento2.com';
// internal
// return $this->resultRedirectFactory->create()->setPath('*/*/');
// external
return $this->resultRedirectFactory->create()->setUrl($url);
}
}