Php Laravel 5.0';s Route::post呈现一个空页面,为什么Route::get可以正常工作
我不熟悉laravel和php。我试图让基本表单正常工作,但当我想使用Route::post()时,会得到一个空页面。 我已经看过多个教程,但在我的(失败的)代码和工作示例之间找不到任何区别 My routes.php:Php Laravel 5.0';s Route::post呈现一个空页面,为什么Route::get可以正常工作,php,laravel,xampp,Php,Laravel,Xampp,我不熟悉laravel和php。我试图让基本表单正常工作,但当我想使用Route::post()时,会得到一个空页面。 我已经看过多个教程,但在我的(失败的)代码和工作示例之间找不到任何区别 My routes.php: <?php Route::get('/', function() { return view('index'); }); Route::post('creating', function() { return 'Creating something';
<?php
Route::get('/', function() {
return view('index');
});
Route::post('creating', function() {
return 'Creating something';
});
及
确实有效。在检查错误日志(duh?!)后,我注意到存储/目录的权限不足。 修复此问题后,我仍然需要:
“illumb/html”:“5.0.*”
'lluminate\Html\HtmlServiceProvider'
添加到providers数组,然后
'Form'=>'illumb\Html\FormFacade',
在config/app.php文件中的别名数组中添加'HTML'=>'illumb\HTML\HtmlFacade'
{!!Form::token()!!}
添加到视图中这解决了整个问题而不是创建try put/creating in your routes.php文件我已经尝试过了,没有什么不同。但是感谢您的评论,我将其添加到了描述中。如果您将路由更改为
route::get()
,并将表单方法更改为method=“get”
,它是否有效?如果我将其更改为route::get()
和method='get'
,它确实有效。。这是什么意思?
<br>
<form action='creating' method='post'>
<button type="submit"> Create something </button>
</form>
</br>
Route::get(creating, function() {
return 'Creating something';
})
method = 'get'