Php 检测Magento 2上的成功页面
有没有办法检查我是否在Magento 2的成功页面上Php 检测Magento 2上的成功页面,php,magento,magento2,Php,Magento,Magento2,有没有办法检查我是否在Magento 2的成功页面上 例如,我知道在Magento 1中,我们可以检查和比较动作名称。但在Magento 2中,也有类似的东西?一种方法是通过URL 在您的类中,在构造中使用以下内容: public function __construct( // ... \Magento\Framework\UrlInterface $urlInterface, // ... ) {
例如,我知道在Magento 1中,我们可以检查和比较动作名称。但在Magento 2中,也有类似的东西?一种方法是通过URL 在您的类中,在构造中使用以下内容:
public function __construct(
// ...
\Magento\Framework\UrlInterface $urlInterface,
// ...
)
{
//...
$this->_urlInterface = $urlInterface;
// ...
}
使用$this->\u urlInterface->getCurrentUrl()
可以获得当前url,这样就可以对照签出成功url进行检查