Home >Backend Development >PHP Tutorial >PHP's CI framework keeps looping endlessly. What's the reason?
application/controllers/sponsor.php
<code>class Sponsor extends CI_Controller{ public function index($page = 'home'){ $this->load->library('base');//如果使用 $this->load->libraries('base'); 必死循环 $this->base->pageLogin(); print_r(8888); } } </code>
application/libraries/Base.php
<code>class Base{ public function __construct(){ $this->CI =& get_instance(); } public function pageLogin($must=false){ var_dump($this->CI->session);//如果使用 $this->session 必死循环 } } </code>
The above two places are fatal loops.
I heard that the CI framework is quite easy to use. I have an urgent project these days. I used CI for a day and I cried. I didn’t even write the WeChat login. If I write a wrong step, it will lead to an endless loop. Can you report the error to me? Brother TAT.
application/controllers/sponsor.php
<code>class Sponsor extends CI_Controller{ public function index($page = 'home'){ $this->load->library('base');//如果使用 $this->load->libraries('base'); 必死循环 $this->base->pageLogin(); print_r(8888); } } </code>
application/libraries/Base.php
<code>class Base{ public function __construct(){ $this->CI =& get_instance(); } public function pageLogin($must=false){ var_dump($this->CI->session);//如果使用 $this->session 必死循环 } } </code>
The above two places are fatal loops.
I heard that the CI framework is quite easy to use. I have an urgent project these days. I used CI for a day and I cried. I didn’t even write the WeChat login. If I write a wrong step, it will lead to an endless loop. Can you report the error to me? Brother TAT.
It shouldn’t be at the controller
function __construct(){
<code> parent::__construct()</code>
Then introduce librari’s
}
here?
<code>$this->load->library('Base');</code>
When loading a class library, the name must correspond to the class library name!