On a codeigniter installation, I am trying to use the inbuilt $this->input->post('some_data') function, however $this->input->post() is an empty array.

在codeigniter安装上,我试图使用内置的$ this-> input-> post('some_data')函数,但$ this-> input-> post()是一个空数组。

A print_r($_POST) gives all the variables fully and correctly?

print_r($ _ POST)完全正确地给出了所有变量?

According to the codeigniter docs, The input class "is initialized automatically by the system so there is no need to do it manually", leaving me wondering what else I'm meant to do.

根据codeigniter文档,输入类“由系统自动初始化,因此不需要手动执行”,让我想知道我还有什么意思要做。

Any thoughts on how I should try to get this working?

有关如何尝试使其工作的任何想法?

Thanks!

谢谢!

13 个解决方案

#1


23

You can check, if your view looks something like this (correct):

如果您的视图看起来像这样(正确),您可以检查:

<form method="post" action="/controller/submit/">

vs (doesn't work):

vs(不起作用):

<form method="post" action="/controller/submit">

Second one here is incorrect, because it redirects without carrying over post variables.

这里的第二个是不正确的,因为它重定向而不携带post变量。

Explanation:

说明:

When url doesn't have slash in the end, it means that this points to a file.

当url最后没有斜杠时,这意味着它指向一个文件。

Now, when web server looks up the file, it sees, that this is really a directory and sends a redirect to the browser with a slash in the end.

现在,当Web服务器查找文件时,它会看到这实际上是一个目录,并在最后用斜杠向浏览器发送重定向。

Browser makes new query to the new URL with slash, but doesn't post the form contents. That's where the form contents are lost.

浏览器使用斜杠对新URL进行新查询,但不发布表单内容。这就是表单内容丢失的地方。

更多相关文章

  1. 请问如何用php实现表单提交后以邮件的形式把表单内容发到邮箱中
  2. 使用pregex提取最后2个斜杠之间的内容
  3. laravel 框架自带表单验证
  4. AJAX学习之提交表单
  5. 在提交注册表单时使用jQuery显示错误
  6. 如果改变输入值,jQuery提交表单
  7. 如何在表单操作中执行PHP函数?
  8. mysql dos命令 创建表单,选择数据库
  9. 如何在表单行SQL中检查是否有任何值为Null

随机推荐

  1. Android UI线程和非UI线程
  2. 深度解析Android中字体设置
  3. 基于Android官方Paging Library的Recycle
  4. [置顶] Android(安卓)编码规范
  5. Android 升级SDK管理器版本到20,安装Andro
  6. 使用html,javascript,css,phonegap创建开
  7. android系统定制从听说到入门二
  8. Android解析XML-详尽
  9. android基础知识03——事件处理01:主要事
  10. Android Socket 与 IOS Socket