简体   繁体   English

为什么我的页面给我404

[英]Why my page gives me 404

I create a new controller in codeIgniter: 我在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: 这是我的观点,它仅执行javascript操作:

<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? 但是,当我转到链接“ localhost / get”时,它给了我404。有人可以帮助我吗?

Make sure your url helper autoloaded 确保您的网址帮助程序已自动加载

Your are loading a php in javascript I would think instead of update.php then best update.js 您正在用JavaScript加载PHP,我认为不是update.php,而是最好的update.js

Then try 然后尝试

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

Assets folder in main directory. 主目录中的Assets文件夹。

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 确保模型和控制器的类和文件名也确保首字母是大写示例Welcome.php而不是welcome.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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