Answer the question
In order to leave comments, you need to log in
How to determine the current id in Yii2?
Yii::$app->user->identity->id;
So you can determine the id of the current user
And how can you, for example, determine the id of the current page? Yii::$app->objects->identity->id;
doesn't work like that
Answer the question
In order to leave comments, you need to log in
The page has no id.
If you mean the id of some model from which you form the page, then you can either find it in the url parameters (if you pass one).
Or maybe you mean id for action?
You can place this code in the view:
and see everything that you can get, there are module and controller id, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question