【问题标题】:How to hide controller name from url cakephp 2.6.9 for all my functions name? [duplicate]如何为我的所有函数名称从 url cakephp 2.6.9 中隐藏控制器名称? [复制]
【发布时间】:2015-07-20 11:26:53
【问题描述】:

例如目前我的网址是:

http://www.totalcableusa.com/frontends/troubleshoot

我的预期网址是: http://www.totalcableusa.com/troubleshoot

如何在 cakephp 中使用路由来做到这一点?

请记住,我需要不止一条路线的解决方案。例如'index'、'troubleshoot'、'tariffplan'等

【问题讨论】:

    标签: php cakephp cakephp-2.0


    【解决方案1】:

    这仅适用于故障排除页面,不适用于其他页面。 试试这个

    Router::connect('/:action', array('controller' => 'Frontends'));
    

    【讨论】:

      【解决方案2】:

      转到 app/config/routes.php

      写下面一行

      Router::connect('/troubleshoot',array('controller' => 'frontends', 'action' => 'troubleshoot'));

      【讨论】:

      • 这个解决方案只适用于一个功能,但我有很多功能,例如“索引”、“疑难解答”、“关税计划”、“whytotalcable”、“联系方式”、“新闻”、“经销商”、“运输” , '包'。
      • 所以你必须像“Abdus Sattar Bhuiyan”所说的那样
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-16
      • 1970-01-01
      • 2013-08-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多