我发现很多人都问过这个问题。但没有一个答案可以解决我的问题。所以发布新帖子。
控制器\ login.php中
class Login extends CI_Controller {
public function __construct(){
parent::__construct();
}
public function index(){
$this->load->view('login/index');
}
public function process(){
echo 'hi';
}
}
视图\登录\的index.php
<?php echo form_open('login/process'); ?>
<button type="submit" >OK</button>
<?php echo form_close(); ?>
设置\ config.php中
$config['base_url'] = 'http://localhost/aiop/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
root .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php
当我使用http://localhost/aiop/
启动应用程序时,它正在启动login/index.php
。当我点击页面上的按钮时,它会尝试导航到http://localhost/aiop/login/process
并说404
答案 0 :(得分:0)
啊最后我明白了。应用程序文件夹名称与config(aiop)中定义的不同(AIOP)。虽然这看起来很愚蠢,但我认为它可以帮助那些来自非案例敏感世界的人(Windows / .NET)