【问题标题】:Remove Controller & function name from url using codeigniter使用 codeigniter 从 url 中删除控制器和函数名称
【发布时间】:2014-12-16 13:54:31
【问题描述】:

我想从我的 url 中删除控制器和函数名称。我的网址看起来像

example.com/config/addRoom.aspx

其中“config”控制器名称和“addRoom”函数/方法名称。我正在使用 htaccess 删除 index.php。我像这样配置我的 routes.php 文件

    $route['room'] = "config/addRoom";

但它不起作用。找不到页面请帮助

【问题讨论】:

  • 试试网址example.com/room
  • @RakeshSharma 当我手动编写此网址时,它会将我重定向到与此链接 example.com/config/addRoom.aspx 相同的页面,但当我访问 example.com/config/addRoom.aspx 时我想要此通过单击菜单链接 我的网址将类似于 example.com/room。我该怎么做?

标签: php codeigniter codeigniter-2 codeigniter-url codeigniter-routing


【解决方案1】:

请在您想要重定向的地方写上“房间”.. 就像现在你在写

在控制器中:- 重定向(“配置/添加房间”);

制作它 重定向(“房间”);

或在视图中:- 现在你写得像 href="config/addRoom"

请做吧

href="房间"

【讨论】:

    猜你喜欢
    • 2016-11-02
    • 2018-01-10
    • 2011-11-28
    • 1970-01-01
    • 1970-01-01
    • 2011-08-04
    • 2017-04-10
    • 1970-01-01
    • 2011-09-05
    相关资源
    最近更新 更多