0

我将 CakePHP 应用程序从一台服务器移动到另一台服务器,但在新服务器上运行会出现此错误,请记住 ita 是语言路径,其中 URL 看起来像这样 http://www.c2cistanbul.com/ita/post /263

缺少控制器错误:找不到 ItaController。错误:在以下文件中创建类 ItaController:app/controllers/ita_controller.php

<?php
class ItaController extends AppController {

    var $name = 'Ita';
}
?>

注意:如果要自定义此错误消息,请创建 app/views/errors/missing_controller.ctp

路线

Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
$par = Router::parse(substr($_SERVER['REQUEST_URI'],6));
Router::reload();
Router::connect('/',  array('controller' => 'site', 'action' => 'home','ita'));
Router::connect('/admin', array('controller' => 'utente', 'action' => 'logged'));
$url = array('home');   
if (in_array($par['controller'],$url))
{
    Router::connect($par['controller'].'/*/', array('controller' => 'site','action' => $par['controller']));
}

$lang = array('ita', 'eng', 'deu', 'rus','fra');
if (in_array($par['controller'], $lang)){
    Router::connect('/ita/_(.*)', array('controller' => 'site', 'action' => 'stdpage','ita',$par['action'],));
    Router::connect('/eng/_(.*)', array('controller' => 'site', 'action' => 'stdpage','eng',$par['action']));
    Router::connect('/fra/_(.*)', array('controller' => 'site', 'action' => 'stdpage','fra',$par['action']));
    Router::connect('/rus/_(.*)', array('controller' => 'site', 'action' => 'stdpage','rus',$par['action']));

    Router::connect('/ita/', array('controller' => 'site','action' => 'home','ita'));
    Router::connect('/eng/', array('controller' => 'site','action' => 'home','eng'));
    Router::connect('/fra/', array('controller' => 'site','action' => 'home','fra'));
    Router::connect('/rus/', array('controller' => 'site','action' => 'home','rus'));

    Router::connect('/ita/'.$par['action'].'/*/', array('controller' => 'site','action' => $par['action'],'ita'));
    Router::connect('/eng/'.$par['action'].'/*/', array('controller' => 'site','action' => $par['action'],'eng'));
    Router::connect('/fra/'.$par['action'].'/*/', array('controller' => 'site','action' => $par['action'],'fra'));
    Router::connect('/rus/'.$par['action'].'/*/', array('controller' => 'site','action' => $par['action'],'rus'));
4

1 回答 1

0

明白了,谢谢大家,错过了

$par = Router::parse(substr($_SERVER['REQUEST_URI'],6));

对于那个很抱歉。

于 2013-03-01T08:16:51.330 回答