Reputation:
Redirect function not working after in controller
Our Code
function deactive_users($id)
{
$this->user->deactiveUser($id);
redirect('admin/manageuser', 'refresh');
}
We have run this code no any error display & not redirect to any page but show only blank screen
Upvotes: 2
Views: 3013
Reputation: 2968
Solution 1.
Not sure but your Base_url
config variable might be incorrectly set. In config/config.php
if your base_url
was set using a single quote. Allowing CI3 to guess the protocol, it would default to $_SERVER['SERVER_ADDR']
, which would return ::1 if you are working locally. Furthermore, when you set the variable to 'http://localhost/projectname
', using single quotes the exact same problem should pop up as when it was using the auto SERVER_ADDR
Try to switch the base URL from single, to double quotes.
Something like this:
$config['base_url'] = "http://localhost/projectname/";
Solution 2.
If that doesn't work then go to your config/config.php
file and edit it where
$config['log_threshold'] = 0; // change this to 4 so it logs all erros in logs folder
run your application by the browser and check inside your /logs
folder the log.php
file, it will contain all the application errors.
Solution 3.
If you see an error like Session class already loaded. Second attempt ignored. then try using this:
if(!isset($CI->session)):
$CI->load->library('session');
endif;
Upvotes: 2