Welcome Guest, Not a member yet? Register   Sign In
How to stop codeigniter execution manually.
#1

[eluser]codeigniterzzz[/eluser]
Basically i want to stop codeigniter executing from anywhere in a controller, and i don't mean just return after loading a view. So for example, lets say i have a method i call within my controller, and in that method I want to stop execution of codeigniter after loading the view. Example:

Code:
class xample extends CI_Controller
{
    public function __construct()  
    {
        parent::__contruct();
    }

    public function testing()
    {
        $this->stopexecution();
        //  other code, w/e it may be.
    }

    private function stopexecution()
    {
         // code for stopping codeigniter execution after loading a view in this method.
    }
}

in the stopexecution() method, how do i stop codeigniter execution?
#2

[eluser]solid9[/eluser]
exit();
#3

[eluser]solid9[/eluser]
Sometimes if you want to stop or doing just nothing is just don't put any codes.
for example,
Code:
if($yes)
{
  //put some codes here.
  echo 'yehey...!';
}
else
{
   //Don't put any codes here.
}
#4

[eluser]codeigniterzzz[/eluser]
[quote author="solid9" date="1352432559"]exit();[/quote]

exit() is a php fucntion, does not have anything to do with properly exiting codeigniter.
#5

[eluser]solid9[/eluser]
That is why CodeIgniter is called a framework for PHP.
Don't be afraid to use it.
#6

[eluser]Aken[/eluser]
What exactly is the purpose of "stop CodeIgniter"? If you want a controller method to no longer process, just add a return; to it.




Theme © iAndrew 2016 - Forum software by © MyBB