Laravel 5.0';s Route::post渲染了一个空页面,为什么Route::get工作得很好


Laravel 5.0's Route::post renders an empty page, why is this when Route::get works just fine

我是laravel和php的新手。我正在尝试让基本表单工作,但当我想使用Route::post()时,我会得到一个空页面。我看过多个教程,但在我的(失败的)代码和工作示例之间找不到任何区别。

我的路线.php:

<?php
Route::get('/', function() {
    return view('index');
});
Route::post('creating', function() {
    return 'Creating something';
});

index.blade.php:

<br>
<form action='creating' method='post'>
    <button type="submit"> Create something </button>
</form>
</br>

我在OS X Yosemite上使用Laravel 5.0和XAMPP。如前所述:

localhost/test/public

将使用"创建内容"按钮呈现页面。但当按下它时,我会得到一个空白页面(url将是:localhost/test/public/createing)

编辑:我试着把"创建"改为"/创建",这没什么区别。

第2版:更改为:

Route::get(creating, function() {
    return 'Creating something';
})

method = 'get'

确实有效。

在检查错误日志(duh?!)后,我注意到存储/目录的权限不足。修复后,我仍然需要:

  1. "illuminate/html": "5.0.*"添加到composer.json文件中
  2. 'lluminate'Html'HtmlServiceProvider'添加到提供者阵列,以及'Form'=> 'Illuminate'Html'FormFacade', 'HTML'=> 'Illuminate'Html'HtmlFacade'到config/app.php文件中的别名数组
  3. {!! Form::token() !!}添加到视图

这修复了整个问题