Container.php 行 749 中的 ReflectionException:Class App\Http\Controllers\registration 不存在
ReflectionException in Container.php line 749: Class App\Http\Controllers\registration does not exist
我是 laravel 5 的新手。3.Now 我创建了一个表单,当我提交我的表单时它显示了一个错误,如
ReflectionException in Container.php line 749: Class
App\Http\Controllers\registration does not exist
- 在 Container.php 行 749
- 在反射类->__construct('App\Http\Controllers\registration')
在 Container.php 第 749 行
- 在Container->build('App\Http\Controllers\registration', array())中
Container.php 第 644 行
- 在Container->make('App\Http\Controllers\registration', array())中
Application.php 第 709 行
- 在Application->make('App\Http\Controllers\registration')中
Route.php 在 Route->getController() 的第 203 行 Route.php 第 316 行
- 在 Route.php 第 278 行
中的 Route->controllerMiddleware()
- 在 Router.php 第 655 行
中的 Route->gatherMiddleware()
- 在 Router.php 行中的 Router->gatherRouteMiddleware(object(Route))
635
- 在 Router->runRouteWithinStack(object(Route), object(Request)) 中
Router.php 第 618 行
- 在 Router.php 第 596 行
中的 Router->dispatchToRoute(object(Request))
- 在 Kernel.php 第 268 行
中的 Router->dispatch(object(Request))
- 在内核->Illuminate\Foundation\Http{closure}(object(Request)) 在
Pipeline.php 第 53 行
- 在 Pipeline->Illuminate\Routing{closure}(object(Request)) in
CheckForMaintenanceMode.php 第 46 行
- 在 CheckForMaintenanceMode->handle(object(Request),
Pipeline.php 第 137 行
中的对象(闭包))
- 在 Pipeline->Illuminate\Pipeline{closure}(object(Request)) in
Pipeline.php 第 33 行
- 在 Pipeline->Illuminate\Routing{closure}(object(Request)) in
Pipeline.php 第 104 行
- 在 Pipeline->then(object(Closure)) 在 Kernel.php line 150
- 在 Kernel.php 中的内核->sendRequestThroughRouter(object(Request))
第 117 行
- 在 index.php 第 53 行
中的内核->handle(object(Request))
- 在 require_once('C:\xampp\htdocs\laravel_demo\public\index.php') 在
server.php 第 21 行
我有一条类似
的路线
Route::resource('registration','RegistrationController');
Route::post('store','registration@store');
这里我的RegistrationController重命名为registration
我的注册控制器:
<?php
namespace App\Http\Controllers;
use DB;
use Illuminate\Http\Request;
use App\RegistrationModel;
class RegistrationController extends Controller
{
public function index()
{
// $uers=DB::table('tset')->get();
//return $uers;
return view('pages.registration');
// return view('pages.registration')->with('users',$uers); //return users from db
}
public function store()
{
}
}
我的浏览页面:
{{Form::open(array('action' => 'registration@store', 'method' => 'post'))}}
<table>
<tr>
<td>
Entr SNO:
</td>
<td>
{!! Form::text('sno', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Enter Name:
</td>
<td>
{!! Form::text('sname', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Enter Course:
</td>
<td>
{!! Form::text('course', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Entr SNO:
</td>
<td>
{{ Form::select('number', [1, 2, 3], null, ['class' => 'field']) }}
</td>
</tr>
<tr>
<td>
{!! Form::submit('Submitform', ['class' => 'btn btn-primary']) !!}
</td>
</tr>
</table>
{!! Form::close() !!}
我不知道为什么当我点击保存按钮保存时出现这个错误 post.Please 帮帮我
您应该在注册资源之前通过单独添加到该方法的路由来向资源控制器添加新方法。
所以你的路线应该是:(注意顺序)
Route::post('store','RegistrationController@store');
Route::resource('registration','RegistrationController');
你认为它应该用作:
{{Form::open(array('action' => 'RegistrationController@store', 'method' => 'post'))}}
注意 - 不要重命名您的 RegistrationController
来自docs
If you need to add additional routes to a resource controller beyond
the default set of resource routes, you should define those routes
before your call to Route::resource
; otherwise, the routes defined by
the resource method may unintentionally take precedence over your
supplemental routes.
我是 laravel 5 的新手。3.Now 我创建了一个表单,当我提交我的表单时它显示了一个错误,如
ReflectionException in Container.php line 749: Class App\Http\Controllers\registration does not exist
- 在 Container.php 行 749
- 在反射类->__construct('App\Http\Controllers\registration') 在 Container.php 第 749 行
- 在Container->build('App\Http\Controllers\registration', array())中 Container.php 第 644 行
- 在Container->make('App\Http\Controllers\registration', array())中 Application.php 第 709 行
- 在Application->make('App\Http\Controllers\registration')中 Route.php 在 Route->getController() 的第 203 行 Route.php 第 316 行
- 在 Route.php 第 278 行 中的 Route->controllerMiddleware()
- 在 Router.php 第 655 行 中的 Route->gatherMiddleware()
- 在 Router.php 行中的 Router->gatherRouteMiddleware(object(Route)) 635
- 在 Router->runRouteWithinStack(object(Route), object(Request)) 中 Router.php 第 618 行
- 在 Router.php 第 596 行 中的 Router->dispatchToRoute(object(Request))
- 在 Kernel.php 第 268 行 中的 Router->dispatch(object(Request))
- 在内核->Illuminate\Foundation\Http{closure}(object(Request)) 在 Pipeline.php 第 53 行
- 在 Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php 第 46 行
- 在 CheckForMaintenanceMode->handle(object(Request), Pipeline.php 第 137 行 中的对象(闭包))
- 在 Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php 第 33 行
- 在 Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php 第 104 行
- 在 Pipeline->then(object(Closure)) 在 Kernel.php line 150
- 在 Kernel.php 中的内核->sendRequestThroughRouter(object(Request)) 第 117 行
- 在 index.php 第 53 行 中的内核->handle(object(Request))
- 在 require_once('C:\xampp\htdocs\laravel_demo\public\index.php') 在 server.php 第 21 行
我有一条类似
的路线Route::resource('registration','RegistrationController');
Route::post('store','registration@store');
这里我的RegistrationController重命名为registration
我的注册控制器:
<?php
namespace App\Http\Controllers;
use DB;
use Illuminate\Http\Request;
use App\RegistrationModel;
class RegistrationController extends Controller
{
public function index()
{
// $uers=DB::table('tset')->get();
//return $uers;
return view('pages.registration');
// return view('pages.registration')->with('users',$uers); //return users from db
}
public function store()
{
}
}
我的浏览页面:
{{Form::open(array('action' => 'registration@store', 'method' => 'post'))}}
<table>
<tr>
<td>
Entr SNO:
</td>
<td>
{!! Form::text('sno', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Enter Name:
</td>
<td>
{!! Form::text('sname', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Enter Course:
</td>
<td>
{!! Form::text('course', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Entr SNO:
</td>
<td>
{{ Form::select('number', [1, 2, 3], null, ['class' => 'field']) }}
</td>
</tr>
<tr>
<td>
{!! Form::submit('Submitform', ['class' => 'btn btn-primary']) !!}
</td>
</tr>
</table>
{!! Form::close() !!}
我不知道为什么当我点击保存按钮保存时出现这个错误 post.Please 帮帮我
您应该在注册资源之前通过单独添加到该方法的路由来向资源控制器添加新方法。
所以你的路线应该是:(注意顺序)
Route::post('store','RegistrationController@store');
Route::resource('registration','RegistrationController');
你认为它应该用作:
{{Form::open(array('action' => 'RegistrationController@store', 'method' => 'post'))}}
注意 - 不要重命名您的 RegistrationController
来自docs
If you need to add additional routes to a resource controller beyond the default set of resource routes, you should define those routes before your call to
Route::resource
; otherwise, the routes defined by the resource method may unintentionally take precedence over your supplemental routes.