【问题标题】:.htaccess doesn't support inserting data on codeigniter.htaccess 不支持在 codeigniter 上插入数据
【发布时间】:2015-11-18 22:01:52
【问题描述】:

我的服务器上有一个 .htaccess 文件(使用 codeigniter)

这是我的浏览页面

<form action='cms/register' method ='post'>
bla bla bla
</form>

以及众所周知的控制器模型 问题是当我点击提交时没有任何反应 但是如果我将表单标题更改为那样

<form action='cms/index.php/register' method='post'>

evreything 有效,所以问题出在 .htaccess 中。

我该如何解决?

【问题讨论】:

  • 您好,欢迎来到 SO,我强烈建议您查看 the tour。如果您确定这是一个 .htaccess 问题,那么为什么不在您的问题中包含 .htaccess 代码呢?
  • 对不起,这是我的 htacces
  • 我是新的 instackover 我不知道该怎么做
  • 编辑您的问题并粘贴到底部的 htaccess 代码中。
  • 这就是为什么我建议你看看the tour 它将向你介绍 SO 的工作原理并帮助你:)

标签: php apache .htaccess mod-rewrite


【解决方案1】:

像这样使用动态网址:

$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';

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-27
    • 2020-06-07
    • 2015-08-30
    • 2021-06-14
    • 2013-03-28
    • 1970-01-01
    • 2016-10-21
    相关资源
    最近更新 更多