Routes.php
Route::get('tool/url_translate', function()
{
$url = Input::get('url');
echo $url;
return View::make('tool.url_translate');
});
tool/url_translate.blade.php
......
{{ Form::open(array('url'=>'tool/url_translate')) }}
{{ Form::token() }}
<div class="col-xs-4">
{{ Form::text('url', '', array('class'=>'form-control col-xs-2', 'placeholder'=>'please enter url')) }}
</div>
{{ Form::submit('submit', array('class'=>'btn btn-primary')) }}
{{ Form::close() }}
......
Problem: When I submit this form, it throw an exception.
----------------------------- Exception -----------------------------
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
How to do it, anybody can hely me? thanks!
your route is only for "get" -->
Route::get
if you post, you should use -->
Route::post
or for both
Route::any
Or keep the get route and change the form opening to
{{ Form::open(array('url'=>'tool/url_translate', 'method' => 'GET')) }}
Laravel defaults to POST.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community