【发布时间】:2015-05-31 18:00:14
【问题描述】:
在 routes.php 中,我在所有路由上都有这段代码:
# Lang::get('routes.page') = 'page';
if (preg_match('/\\/'.Lang::get('routes.page').'-[0-9]+/i',
$_SERVER['REQUEST_URI'], $matches)) {
if (isset($matches[0]) and strtolower($matches[0]) !== $matches[0]) {
$url = str_ireplace(
'/'.Lang::get('routes.page').'-',
'/'.Lang::get('routes.page').'-',
$_SERVER['REQUEST_URI']
);
return Redirect::to($url, 301);
}
}
这给了我错误:
异常处理程序中的错误:未定义路由 [内容]。 (查看:/path/to/app/views/view.blade.php)(查看:/path/to/app/views/view.blade.php)在/path/to/vendor/laravel/framework/src/照亮/路由/UrlGenerator.php:231
这是 Laravel 4.2。为什么会出现此错误?
【问题讨论】:
-
您的路线文件中有
Route::get('content', ...)或类似名称吗? -
不,不在路线中。而且我没有在“return”运算符上方的代码中包含这个刀片模板文件。