【发布时间】:2014-05-07 08:53:43
【问题描述】:
该程序是一个 URL 缩短器,我只是从一些教程中尝试(对于 Laravel 3,但我使用的是 laravel 4),当我单击缩短的 URL 时,它应该给我“一些 URL”作为输出.
<?php
Route::get('/', function()
{
return View::make ('home.index');
});
Route::post('/',function(){
$url = Input::get('url');
// If the url is already in the table, return it
$record=Url::whereurl($url)->first();
if ($record) {
//then return it
return View::make('home.result')
->with('shortened', $record->shortened);
}
});
Route::any('{shortened}',function($shortened)
{ echo "Everything is ok with: ".$shortened; })
->where('shortened', '.*');
而是进入一个错误页面说
“未找到请求的 URL /asdf 在此服务器上未找到。”
我认为这是我的一个非常简单的错误。我不确定他们是否更改了语法或关键字。我也无法从 laravel 文档中找到任何解决方案。
【问题讨论】: