如何解决:Route.php第333行中的ReflectionException:方法App \ Http \ Controllers \ PerekamanController :: show()不存在"在Laravel 5.3中? [英] How to resolve : ReflectionException in Route.php line 333: Method App\Http\Controllers\PerekamanController::show() does not exist" in Laravel 5.3?
问题描述
我的proses.blade.php是这样的:
My proses.blade.php is like this :
<form method="POST" action="{{ url('/perekamans/proses') }}">
{!! csrf_field() !!}
...
</form>
我的routes \ web.php是这样的:
My routes\web.php is like this :
Route::resource('perekamans', 'PerekamanController');
Route::get('perekamans/proses', ['uses' => 'PerekamanController@listdata']);
我的PerekamanController是这样的:
My PerekamanController is like this :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PerekamanController extends Controller
{
public function index(Request $request)
{
return view('perekamans.index');
}
public function listData()
{
return view('perekamans.show');
}
}
我的show.blade.php是这样的:
My show.blade.php is like this :
@extends('layouts.app')
@section('content')
<section class="content-header">
<h1 class="pull-left">PEREKAMAN DATA</h1>
</section>
<div class="content">
<div class="clearfix"></div>
@include('flash::message')
<div class="clearfix"></div>
<div class="box box-primary">
<div class="box-body">
@include('perekamans.table')
</div>
</div>
</div>
@endsection
我从这样的网址中拨打电话: http://localhost/mysystem/public/perekaman/proses
I call from url like this : http://localhost/mysystem/public/perekaman/proses
存在这样的错误:
哎呀,看起来好像出了点问题. Route.php第333行中的1/1 ReflectionException:方法App \ Http \ Controllers \ PerekamanController :: show()不存在
Whoops, looks like something went wrong. 1/1 ReflectionException in Route.php line 333: Method App\Http\Controllers\PerekamanController::show() does not exist
in Route.php line 333
at ReflectionMethod->__construct('App\Http\Controllers\PerekamanController', 'show') in Route.php line 333
at Route->signatureParameters('Illuminate\Database\Eloquent\Model') in Router.php line 789
看起来我的代码是正确的,但是为什么它仍然是错误?
It looks like my code is correct, but why it is still an error?
有什么解决方案可以解决我的问题吗?
Is there any solution to solve my problem?
更新:
对不起,我无法回答您的所有问题.每次我写评论与您回答问题,然后单击评论按钮时,它就不能执行.存在消息:
问题可在2天内获得赏金
因此您可以立即提供任何解决方案
Sorry, I can not answer all your questions. every time I write a comment to answer questions with you, and then click the comment button, it can not. there exist message :
question eligible for bounty in 2 days
so you immediately provide any solution
推荐答案
您在路线上犯了错误:
Route::get('perekamans/proses', ['uses' => 'PerekamanController@listdata']);
Route::resource('perekamans', 'PerekamanController');
更改顺序就这样.
Laravel还有一件事,您可以简化它.
And one more thing at Laravel you can make it simpler.
Route::get('perekamans/proses', 'PerekamanController@listdata');
您无需使用uses
设置它将使用的控制器
you don't need to use uses
to set which controller it will use
这篇关于如何解决:Route.php第333行中的ReflectionException:方法App \ Http \ Controllers \ PerekamanController :: show()不存在"在Laravel 5.3中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!