【问题标题】:CakePhp href links to different controller's viewCakePhp href 链接到不同控制器的视图
【发布时间】:2014-06-06 14:28:48
【问题描述】:

我有 2 个控制器 CubeController.php 和 CuboidController.php 。 他们俩都有 Indec.ctp 作为视图。 我想在 cubeController 页面的视图上创建一个链接来调用 cuboidController 的视图? 我该怎么办????

【问题讨论】:

    标签: cakephp view controller href


    【解决方案1】:

    你可以这样做;

    <?php echo $this->Html->link( "Here a message",   array('controller' => 'cube', 'action' => 'index') ); ?>
    

    【讨论】:

    • 它显示以下错误:错误:动作立方体未在控制器 CuboidController 中定义错误:在文件:app/Controller/CuboidController.php 中创建 CuboidController::Cube()。
    • 试过这个:@Widrogo $this->redirect(array('controller' => 'cube', 'action' => 'index'));
    • 错误是因为你没有函数“Cuboid”是另一个问题,重定向与链接不同,在你的问题中你输入href并转到其他控制器并查看链接。
    猜你喜欢
    • 1970-01-01
    • 2013-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-18
    • 1970-01-01
    • 1970-01-01
    • 2017-06-11
    相关资源
    最近更新 更多