I have this in my controller:
class UpdateStats extends CI_Controller{
public function __construct() {
parent::__construct();
}
function index(){
$this->load->view('update_stats/index');
}
}
my view (index )is in update_stats folder in view folder
When I click on the link that I created:
<li id='proxy'><a href="<?php echo base_url();?>index.php/update_stats/">Master Update</a></li>
or in another form this:
<li id='proxy'><a href="http://localhost/scanner/index.php/update_stats/">Master Update</a></li>
This is the error that i get:
404 Page Not Found
The page you requested was not found.
UPDATE my filename is : updatestats.. my class name UpdateStats I try to enter to http://localhost/scanner/index.php/updatestats
..and i get 404 error
FILE NAME: updatestats.php
CLASS NAME: Updatestats.php
URL DESTINATION: http://localhost/scanner/index.php/updatestats/
CLASS:
class Updatestats extends CI_Controller{
public function __construct() {
parent::__construct();
}
function index(){
$this->load->view('templates/header', $data);
$this->load->view('update_stats/index');
$this->load->view('templates/footer', $data);
}
}
enter code here
Your controller name is UpdateStats
in your class declaration
class UpdateStats extends CI_Controller{
and you are using as /update_stats/
So make both similar, and it may solve your problem.
Your path is wrong. It should be
<?php echo base_url();?>index.php/updatestats
Also its not the view not loading problem, it cannot even find the controller
Your controller name is UpdateStats
but in your url you're calling update_stats
. Change update_stats
to UpdateStats
and see what happens.
不确定,但可能是一些配置问题所以我建议你使用site_url而不是base_url,因为site_url根据你的网站配置创建网址,在你的情况下它将是:
<li id='proxy'><a href="<?php echo site_url('updatestats');?>">Master Update</a></li>
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.