Answer the question
In order to leave comments, you need to log in
Can you please explain the code to a newbie?
I understand that the $this->method() line calls the class instance method.
But how to understand Yii::$app->request?
Does the Yii class have a static $pp property that contains the request object? That's right?
Or, for example, Yii::$app->request->post() here, is the post method called from the $app static property in which there is a request object in which the post method is called?
Please do not beat and explain
Answer the question
In order to leave comments, you need to log in
How does Yii::app() work?
But in general you are right. It's just $app
a variable. I recommend you walk in three directions:
- from index.php and above
- from MyModel and below
- from MyController and below
, just looking at what is inherited from what, briefly.
With what, as you study the framework, do it again and again. Each time you will understand more and more until enlightenment comes))).
By the way, be sure to use some kind of ide like phpStorm. So that a click on request in would take Yii::$app->request->post()
you to this very object. Where can you find answers to your questions.
Does the Yii class have a static $pp property that contains the request object? That's right?
Yii::$app is a static property that holds an application instance. The application has if components, modules, etc.
request is an application component that is responsible for processing client requests.
post() is a method of the request component that returns the data sent in the request body.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question