doulangxun7769 2012-12-16 08:04
浏览 83
已采纳

使用CakePHP进行插件路由

I have a plugin that needs to override the default route for /

The file I have attempting this is at APP/Plugin/Install/Config/routes.php

<?php
Router::connect('/', array('plugin' => 'install', 'controller' => 'installer', 'action' => 'index'));

Which does not work. I am also loading all plugins in my bootstrap. CakePlugin::loadAll();

Am I missing something?

[UPDATE. This file needs to override the main routes.php file in APP/Config/routes.php. Obviously updating the main routes file works and shows the right page, but I am trying to override this file and not modify it directly.]

  • 写回答

3条回答 默认 最新

  • douxie9347 2012-12-16 08:38
    关注

    I haven't tried overriding the default route for a plugin - I have for plain controllers - but I think you'll need 'plugin'=>'install' or somesuch in your array.

    Edit: This bit about plugins in the manual might apply, I think your loadAll should look something like this:

    CakePlugin::loadAll(array(
        'Install' => array('routes' => true)
    ));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态