我控制器文件看起來像這樣未找到控制器方法。在laravel錯誤5.2
<?php
namespace App\Http\Controllers;
use App\Artist;
use App\Song;
use App\Album;
class WebsiteController extends Controller
{
public function getIndex(){
return redirect('/');
}
public function getHome(){
$featuredArtist='';
$featuredAlbum='';
$featuredSong='';
return view('website.welcome')->with(array('featuredArtist'=>$featuredArtist,'featuredSong'=>$featuredSong,'featuredAlbum'=>$featuredAlbum));
}
public function get_listartist(){
$artistList = Artist::select('id','artist_name', 'artist_title','artist_image')->get();
//dd($artistList);
return view('website.listartist')->with(array('artistList'=>$artistList));
//skljhkhkl
}
public function getDonate(){
return view('website.donate');
}
public function getContact(){
return view('website.contact');
}
}
而且我Route.php看起來像這樣
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', '[email protected]');
Route::controller('site', 'WebsiteController');
大多數鏈接比
www.domain正在等。 com/site/listartist
我得到錯誤爲
NotFoundHttpException在compiled.php線9361:控制器方法不 發現..
任何想法,我檢查過了,它看起來罰款
感謝
你有沒有在'Controller'中看到名爲'listartist'的函數? –
@BasheerAhmed laravel如果它的一個get方法它解決了這個函數'getListartist()'相同的代碼在localhost btw工作正常 – Vikram
糟糕我只是忘記了,但非網址工作。 url'http:// mad.ideleads.com/site/home' 'Class'App \ Http \ Controllers \ BaseController'找不到' –