i am fairly new working with codeigniter. I am currently trying to setup an existing codeigniter project but Main controller's index() method is not being called. I have gone through almost all related question posted here @ stackoverflow but nothing seems to work for me.
below is my code:
class Main extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('Front_main');
$this->load->model('Front_expertweb');
}
public function index(){
echo 'im here';
....
}
....
}
EDIT
.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
#<IfModule mod_filter.c>
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE image/*
#</IfModule>
config.php
$config['index_page'] = '' $config['base_url'] = ''
PHP version: 5.+
Codeigniter: 2.+
would really appreciate if you could route me in the ride direction.
much appreciated.
class Main extends CI_Controller {
function __construct()
{
parent::__construct();
// $this->load->model('Front_main');
// $this->load->model('Front_expertweb');
}
public function index(){
echo 'im here';
....
}
....
}
config.php
$config['index_page'] = 'index.php'
$config['base_url'] = 'your project foldername'
Bummmmp! So there was NOTHING wrong with the code. Previous developer had saved configuration URL in database without any documentation.
Thanks to everyone who tried to help.
Cheers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.