📜  $this 在 codeigniter 中的含义 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:37.735000             🧑  作者: Mango

代码示例1
In terms of codeigniter:
You'll notice that each controller in codeigniter extends the base controller class. Using $this in a controller gives you access to everything which is defined in your controller, as well as what's inherited from the base controller.

Most of the use you'll get out of $this involves calling methods which the base class has loaded for you - $this->load, $this->uri, etc.

If I remember correctly, PHP code in a view is run in the context of the controller, so you'll have access to the controller object with $this from there as well.