0
直到最近,我都有一個路由處理器控制器,所有的請求都通過它。這樣我可以根據目錄中的條目將某些項目定向到某些頁面。但是由於某種原因,它最近停止工作,並給了我以下錯誤:Kohana 3路由 - 空的正則表達式
ErrorException [ Warning ]: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Empty regular expression
這來自於比賽()函數在route.php文件。
直到這個類被調用我已經注意到,$ uri變量確實包含一個字符串,但是一旦在該函數中它將變爲NULL,通過該錯誤。
// Routes for product items
foreach($items as $item)
{
Route::set($item->seoUrl, $item->seoUrl)
->defaults(array(
'controller' => 'item',
'action' => 'index',
'id' => $item->id,
));
}
// Error
Route::set('error', 'error(/<action>(/<id>))', array('id' => '.+'))
->defaults(array(
'controller' => 'error',
'action' => '404',
'id' => FALSE,
));
// Standard - normal Kohana behaviour
Route::set('standard', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'catalogue',
'action' => 'index',
));
// RouteHandler Reset - otherwise continuous loop
Route::set('routeHandler', '£€%')
->defaults(array(
'controller' => 'routeHandler',
'action' => 'index',
));
$uri = $this->request->param('uri');
$request = new Request($uri);
echo $request->execute()
->send_headers()
->response;
產品項目的路線仍然有效。這導致我相信它引起不安的標準路線。重置路線必須在那裏,否則我通過routeHandler得到一個常量循環。
奇怪的是,這是所有的工作,並沒有什麼改變在這個劇本據我所知。
任何想法,但將不勝感激。