0

我在此处托管的 Web 应用程序中使用 CakePHP v1.2:http: //lol-land.in

该应用程序在昨天之前运行良好,但它突然开始陷入一些重定向循环。更奇怪的是,问题出在一个控制器上:posts。甚至在大多数功能都可以正常工作的情况下。但是http://lol-land.in/posts正在重定向到 lol-land.in/posts/view/133 ,这反过来又重定向到自己。

实际上 /posts/view/ 形式的 117 个帖子中有 110 个卡在这个 302 重定向中。

谁能告诉我这可能是什么原因造成的?

[CakePHP 1.3 和 PHP5]

编辑:添加视图逻辑

function view($id = null) {
$this->log("View Logic Entry", LOG_DEBUG);
// These Log entires are missing 

$this->layout = 'postview';
if (!$id) {
    $this->Session->setFlash(__('Invalid Post.', true));
    $this->log("Redirect due to missing id", LOG_DEBUG);
    $this->redirect(array('action'=>'index'));
}
$log = $this->Session->read('Auth.User');
$logid = $log['id'];

$temp = $this->Post->read(null, $id);

$ratings = $temp['Rating'];

$this->set(compact('up', 'down', 'userrated', 'userrateid'));

$coms = $temp['Comment'];
$comuser = array();
for ($i=0; $i<count($coms); $i++) {
    $comuser[$i] = $coms[$i]['user_id'];
}
$comuser = $this->Post->User->find('list', array( 'fields'=>array('User.id', 'User.username'),
                      'conditions'=>array("User.id" => $comuser)
                      ));
$this->set(compact('comuser'));

$this->pageTitle = $temp['Post']['title'];
$this->set('post', $temp);
$alltypes = $this->Post->Type->find('list', array('fields'=> array('Type.id', 'Type.typename')));
$selectedtab = -1;
$this->set(compact('alltypes', 'selectedtab' ));


//Calling updateFBStats
// Removed because unnecessary.

}

4

1 回答 1

1

您可能是 1) 对 Auth 组件使用循环引用,或者 2) 控制器中的函数将 do 重定向到方法中的某些内容。你能显示 post_controller.php 函数 view() 的代码吗?

于 2010-08-22T18:03:51.857 回答