我将 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'));