【问题标题】:Codeigniter form submission adds action url with website urlCodeigniter 表单提交添加了带有网站 url 的操作 url
【发布时间】:2015-02-17 19:19:25
【问题描述】:

我正在尝试在 Codeigniter 中以表单操作提交表单,当我提交时我的 url 是“注册/注册”,它正在使用现有 url 添加操作。我的英语太差了,请看附件图片了解详情。

示例:我的网站网址是 example.com/d2t/index.php/Registration 我正在添加 action = "Registration/register" 之类的表单操作。

然后它将我的表单 url 添加到我的网站 url:example.com/d2t/index.php/Registration/Registration/register

【问题讨论】:

  • 将操作更改为 /Registration/register 而不是 Registration/register

标签: php forms codeigniter


【解决方案1】:

使用 site_url() 方法

action="<?php echo site_url("Registration/register") ?>"

或者你可以使用表单助手:

echo form_open('Registration/register');

http://www.codeigniter.com/userguide3/helpers/form_helper.html?highlight=form%20helper

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-23
    相关资源
    最近更新 更多