我的服务器上有一个。htaccess文件(使用codeigniter)
这是我的视图页
<form action='cms/register' method ='post'>
bla bla bla
</form>
和控制器模型大家都知道问题是,当我点击提交什么都没有发生但是如果我把表单标题改成这样
<form action='cms/index.php/register' method='post'>
一切工作,所以问题是来自。htaccess.
我怎么解决它?
像这样使用动态url:
$this->load->helper('url');
然后是:
<form action="<?php echo site_url("register"); ?>">
如果site_url()不工作,那么尝试base_url()。
更新:
从application/config/config.php复制,如果使用mod_rewrite,将'index.php'
从$config['index_page']
更改为''
。
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';