0

I want to get base URL with parameter in Yii2 eg

functionName("controller/action");

I want

domain.com/controller/action

1 Answers1

2

The simple way is use the proper yii helpers for ruoting .. in this the yii\helpers\Url;

eg:

 Url::to(['controller/action'], true);

see yii2 doc this https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107