I have been developing a small web application with CodeIgniter. After testing it out locally I went to put it on my web server to allow a couple other people test out some
Please check the root/application/core/
folder files whether if you have used any of MY_Loader.php
, MY_Parser.php
or MY_Router.php
files.
If so, please try by removing above files from the folder and check whether that make any difference. In fact, just clean that folder by just keeping the default index.html file.
I have found these files caused the issue to route to the correct Controller's functions.
Hope that helps!
You are using MVC with OOPS Concept. So there are some certain rules.
1) Your class name (ie: controller name) should be start with capital Letter.
e.g.: your controller name is 'icecream'. that should be 'Icecream'
In localhost it might not be compulsory, but in server it will check all these rules, else it can't detect the right class name.
Solved the issue. Change your class name to make only the first letter capitalized. so if you got something like 'MyClass' change it to 'Myclass'. apply it to both the file name and class name.
I have solved this problem, please just make few changes
1- all controller class name should start with capital letter. i mean first letter of class should be capital . eg we have controler with class name Pages
so it should be Pages not pages
2- save the controller class Pages as Pages.php
not pages.php
so first letter must be capital
same for model, model class first letter should be capital and also save model class as Pages_model.php
not page_model.php
hope this will solve ur problem
Changing the first letter to uppercase on the file's name and class name works.
file: controllers/Login.php
class: class Login extends CI_Controller { ... }
The file name, as the class name, should starts with capital letter. This rule applys to models too.
https://www.codeigniter.com/user_guide/general/models.html
I am doing it on local and production server this way:
Routes:
$route['default_controller'] = 'Home_controller';
Files' names:
Home_controller.php:
class Home_controller extends CI_Controller {
public function index(){
//loading Home_model
$this->load->model('Home_model');
//get data from DB
$data['db_data'] = $this->Home_model->getData();
//pass $data to Home.html
$this->load->view('Home', $data);
}
}
Home_model.php:
class Home_model extends CI_Model {
...
}
There should be no more problems with cases anymore :)