【问题标题】:Change URL of page in Codeigniter在 Codeigniter 中更改页面的 URL
【发布时间】:2013-03-15 12:16:29
【问题描述】:

这里是交易:我有一个用户登录的登录表单。如果验证通过,他们将被重定向到

example.com/members/landing

如何将其更改为仅example.com/landing。有什么办法可以改变浏览器上显示给用户的url,而在后面,form_open有不同的调用方法

例如:如上所述,代码的形式是

<?php echo form_open(members/landing); ?>

但是浏览器必须显示登陆什么的......

【问题讨论】:

  • 你不能只使用routes config 并在内部定义你的site.com/anything 路由到members/landing 吗?

标签: php javascript html codeigniter url


【解决方案1】:

在 config/routes.php 中:

$route['landing'] = '/members/landing';

它的作用是将任何对example.com/landing 的请求发送到example.com/members/landing 控制器。那么你的表格:

<?php echo form_open('/landing'); ?>

应该按预期工作。

【讨论】:

    【解决方案2】:

    您正在使用 codeigniter,编辑您的 routes.php 并更改默认控制器;或者如果您只需要显示自定义 URL,您可以使用 .htaccess 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-02
      • 2018-03-02
      • 1970-01-01
      • 1970-01-01
      • 2014-01-21
      • 1970-01-01
      • 2010-11-20
      相关资源
      最近更新 更多