【问题标题】:Different routing for two different controllers两个不同控制器的不同路由
【发布时间】:2014-03-24 03:51:21
【问题描述】:

我有两个不同的控制器, AdminController.php 和 HomeController.php

我只想为 HomeController.php 函数添加路由。我为 HomeContrller.php 函数添加了 Router::connect() 函数,它工作正常。 但是我的 AdminController.php 现在不能正常工作:(。

我的问题是,如果我们有两个控制器,我只想为一个控制器功能添加路由。我们该怎么做?

请帮忙。

【问题讨论】:

    标签: cakephp controller routing


    【解决方案1】:

    在 routes.php 中只需指定控制器和操作。例如:

    Router::connect('/profile/*', array('controller' => 'users', 'action' => 'profile'));
    //the * means anything after the slash....www.example.com/profile/123
    

    【讨论】:

      猜你喜欢
      • 2014-10-07
      • 1970-01-01
      • 2017-03-12
      • 1970-01-01
      • 2019-10-26
      • 2013-09-24
      • 2016-03-29
      • 2014-06-18
      • 2015-10-09
      相关资源
      最近更新 更多