简体   繁体   中英

Why my page gives me 404

I create a new controller in codeIgniter:

class Get extends CI_Controller{

    public function up(){
        $this->load->view('get_view.php');
    }

}

And this is my view that executes only a javascript operation:

<script src="/js/update.php" type="text/javascript"></script>

<?php
?>
<script>
updateDB();
</script>

Now I modify my routes in this way:

$route['get']='get/up';

But when I go to the link "localhost/get", it gives me a 404. Can anyone help me?

Make sure your url helper autoloaded

Your are loading a php in javascript I would think instead of update.php then best update.js

Then try

<script type="text/javascript" src="<?php echo base_url('assets/js/update.js');?>" ></script>

Assets folder in main directory.

Update:

Make sure also your class and file names of models and controllers make sure the first letter is uppercase example Welcome.php and not welcome.php

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM