Yii current Url

To Get Current Url

echo Yii::app()->request->requestUri;

Get Action Name

//Anywhere
Yii::app()->controller->action->id
//Inside Controller
public function beforeAction($action)
{
    $actionId = $action->id;
    ..........
}

Get Controller Name

// Anywhere
Yii::app()->controller->id 
//Inside Controller
echo $this->getId();

Leave a Reply

Your email address will not be published. Required fields are marked *