回答:
それは私のために働いています
$this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true])
また、代わりに$ thisで$ blockを使用できます。
そのためには、モジュールのカスタムブロックを使用して、次の操作を行う必要があります。
Magentoの2では、あなたは使用することができます\Magento\Store\Model\StoreManagerInterfaceアクセス変数に格納されている$_storeManager拡張すべてのクラスのために\Magento\Framework\View\Element\Template(ブロッククラスのように、ほとんどTemplate、Messages、Redirectブロックタイプではなく、TextもTextList)を。
この方法でブロック内で、次のメソッドを作成して現在のURLを取得できます。
public function getCurrentUrl() {
return $this->_storeManager->getStore()->getCurrentUrl();
}
それが完了したら、テンプレートで次を呼び出すことができます。
$block->getCurrentUrl();