我是laravel的新手,我嘗試將視圖中的值發佈到控制器。但我沒能獲得通過,因爲我得到錯誤說 FatalErrorException in routes.php line 26: Class 'registration' not found
提交表格時未找到控制器類laravel 5.1
routes.php文件
Route::get('/', function() {
return view('welcome');
});
Route::get('/register', function(){
return view('register');
});
Route::post('/register_action', function()
{
$values = registration::store();
});
控制器
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\model\registration as register_model
class registration extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store()
{
echo 'hello';
register_model::saveFormData();
}
}
查看
<html>
<head>
<meta charset="UTF-8">
<title>Registration</title>
</head>
<body>
{!! Form::open(array('url' => 'register_action')) !!}
<p>Name : {!! Form::text('name') !!}</p>
<p>Email : {!! Form::text('email') !!}</p>
<p>Password : {!! Form::password('password') !!}</p>
<p>Confirm Password : {!! Form::password('cpassword') !!}</p>
<p>{!! Form::submit('Submit') !!}</p>
{!! Form::close() !!}
</body>
</html>
請幫我解決問題並獲取控制器中的發佈值。由於
請不要使用這樣的閉包。將它發送給控制器,並從那裏開始工作。順便說一句,你在上一個命名空間中忘了';'。 – GabMic
你應該大寫你班級的名字。 –