【发布时间】:2016-12-09 22:12:49
【问题描述】:
我的 proses.blade.php 是这样的:
<form method="POST" action="{{ url('/perekamans/proses') }}">
{!! csrf_field() !!}
...
</form>
我的 routes\web.php 是这样的:
Route::resource('perekamans', 'PerekamanController');
Route::get('perekamans/proses', ['uses' => 'PerekamanController@listdata']);
我的 PerekamanController 是这样的:
<?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 是这样的:
@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
存在这样的错误:
哎呀,好像出了点问题。 Route.php 第 333 行中的 1/1 ReflectionException:方法 App\Http\Controllers\PerekamanController::show() 不存在
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
看起来我的代码是正确的,但为什么它仍然是一个错误?
有什么办法可以解决我的问题吗?
更新:
对不起,我不能回答你所有的问题。每次我写评论来回答你的问题,然后点击评论按钮,它不能。存在消息:
2 天内有资格获得赏金的问题
所以你立即提供任何解决方案
【问题讨论】:
-
首先,
public应该是你的根目录,而不是显示在 URL 中 -
其次,在您的路线中,您没有将
proses定义为路线。 -
你也没有定义
perekaman/proses -
而新的错误告诉你
show()方法在PerekamanController上不存在 -
错误是关于 myController,它在哪里?
标签: php laravel laravel-5.3