Answer the question
In order to leave comments, you need to log in
What is the difference between Yii::$app and \Yii::$app?
What role does the slash play? From time to time I meet different spellings, but I did not find the answer in the documentation.
Answer the question
In order to leave comments, you need to log in
Yii::$app - used when the namespace is included via use;
\Yii::$app - used when the namespace is included directly in the code. Actually, the slash before Yii indicates that in order to include this namespace, you need to go beyond the current one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question