Php 重定向错误解释路由

Php 重定向错误解释路由,php,cakephp,redirect,Php,Cakephp,Redirect,当从我的应用程序中删除视频时,我有一个重定向应该可以工作,$this->redirect('/Admin/Dashboard/Videos/Delete'),但是cake试图把我带到一个名为admin的控制器,说admincontroller不存在,我的flash消息也不会像应该的那样发出。我有一个类似的rredirect,this->redirect('/Admin/Dashboard/Videos/Upload'),它工作得很好,但这一个不行,我还尝试使用/Admin/Dashboard/V

当从我的应用程序中删除视频时,我有一个重定向应该可以工作,
$this->redirect('/Admin/Dashboard/Videos/Delete')
,但是cake试图把我带到一个名为
admin
的控制器,说admincontroller不存在,我的flash消息也不会像应该的那样发出。我有一个类似的rredirect,
this->redirect('/Admin/Dashboard/Videos/Upload')
,它工作得很好,但这一个不行,我还尝试使用
/Admin/Dashboard/Videos/Delete/:page'
,但也不起作用。它应该如何正常工作? 我正在使用Cake2.4.4

路线

Router::connect('/Admin/Dashboard/Videos/Upload', array('controller' => 'galleries', 'action' => 'uploadVideos'));
Router::connect('/Admin/Dashboard/Videos/Delete/:page', array('controller' => 'galleries', 'action' => 'deleteVideos'),array('page' => '[0-9]+'));
控制器

public function deleteVideos($id){
        $this->set('title_for_layout', 'Apagar videos');
        $this->layout = 'admin';
        $this->loadModel('GalleryVideo');
        $this->GalleryVideo->id=$id;
        $this->Paginator->settings = $this->paginate;
        $gallery_videos=$this->Paginator->paginate('GalleryVideo');
        $this->set('gallery_videos', $gallery_videos);
        if($this->request->is('post')){
            if(!$this->GalleryVideo->exists()){
                throw new NotFoundException('Erro, este video não foi encontrado.', 'default', array('class'=>'alert flashMessageDanger alert-dismissable'));
            }
            $options = array('conditions' => array('GalleryVideo.'.$this->GalleryVideo->primaryKey=>$id));
            $gallery_video_delete = $this->GalleryVideo->find('first', $options);
            if($this->GalleryVideo->delete()){
                $this->Session->setFlash('O Video foi excluído com sucesso.', 'default', array('class'=>'alert flashMessageSuccess alert-dismissable'));
                $this->redirect('/Admin/Dashboard/Videos/Delete');                
            }else{
                $this->Session->setFlash('Erro, este Video não pôde ser apagado.', 'default', array('class' => 'alert flashMessageDanger alert-dismissable'));
            }
        }
    }
查看

<h2>Videos <small>Apagar Videos</small></h2>
<?php echo $this->Session->flash();?>
<br>
<table class="table table-striped table-condensed table-hover">
<tr>
    <?php
        $i=0;
        foreach( $gallery_videos as $gallery_video ):?>

        <?php

            echo "<td>";
                echo $gallery_video['GalleryVideo']['iframe'];
            echo "</td>";
            echo "<td>";
                echo $this->Form->postLink('Apagar', array('controller'=>'Galleries', 'action'=>'deleteVideos', $gallery_video['GalleryVideo']['id']), array('class'=>'btn btn-lg btn-danger large', 'title'=>'Apagar Video'), __('Tem a certeza que quer apagar este Video?'));
            echo "</td>";
            $i++;
            if($i==1){
                echo "</tr><tr>";
                $i=0;   
            }
        ?>
        <?php endforeach ?>
</tr>
</table>
视频Apagar视频


路由器:

Router::connect('/Admin/Dashboard/Videos/Delete/:page', array('controller' => 'galleries', 'action' => 'deleteVideos'),array('page' => '[0-9]+'))
Router::connect('/Admin/Dashboard/Videos/Delete', array('controller' => 'galleries', 'action' => 'deleteVideos'))
public function deleteVideos($id = null){
....
$this->redirect(array('admin' => true, controller' => 'galleries', 'action' => deleteVideos'));
控制器:

Router::connect('/Admin/Dashboard/Videos/Delete/:page', array('controller' => 'galleries', 'action' => 'deleteVideos'),array('page' => '[0-9]+'))
Router::connect('/Admin/Dashboard/Videos/Delete', array('controller' => 'galleries', 'action' => 'deleteVideos'))
public function deleteVideos($id = null){
....
$this->redirect(array('admin' => true, controller' => 'galleries', 'action' => deleteVideos'));

这会导致重定向,但路由与routes.php中的路由不同,它应该是
/Admin/Dashboard/Videos/Delete
,但它显示
/gallers/deleteVideos/Admin:1
,flash消息也不会显示。我不明白为什么删除后,您会重定向回相同的方法。此外,在你的路由中使用小写字母:“admin/videos/。”我希望cake将用户带回表单并显示成功消息。在访问…/admin/Dashboard/videos/Delete时,你有Delete.ctp视图,其中有一个html表单?我有Delete_videos.ctp,由
array('controller'=>'gallers',action'=>'deleteVideos'使用)
。对不起,我解释错了,这里有带删除按钮的视频列表。