2016-05-24 1 views
0

私はこのプロジェクトを、私の最終学期にAdvanced OSコースのコンセプトを示すために作っています。コマンドラインで提供されると、ブラウザにGUIが表示されます。しかし、その機能には到達できません。それを打つと、私はウェブページ上でこれを参照してください。 "routes.phpの致命的なエラー例外(Windowsでうまく動作し、Linuxでうまくいきます)

Whoops, looks like something went wrong. 
1/1 FatalErrorException in routes.php line 27: Class 'App\Items' not found 

"です。私はreference.`

<?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('/', function() { 
    return view('welcome'); 
}); 

Route::get('postitem', function() { 
    return view('postitem'); 
}); 
Route::auth(); 

Route::get('/home', '[email protected]'); 
Route::post('/itemPosted', '[email protected]'); 
//Route::post('/itemPosted', '[email protected]'); 
Route::get('searchItem', function() { 
    $item = App\Items::all(); 
    $data = array(
     'items' => $item 
     ); 
    return view('searchItem',$data); 
}); 
Route::get('bidnow', function() { 
    return view('bidnow'); 
}); 
Route::post('/bidDone', '[email protected]');` 
+0

オートローダのような音が酷いかもしれません。情報があれば、それはディレクトリセパレータの問題だと思われます。 –

+0

あるいは 'App'ネームスペースディレクトリがどこにあるのかを定義する設定に潜在的にあります。 –

+0

上部に 'use'文を追加し、それを$ item = Items :: all()に変更します。 – Brett

答えて

0

のための私のroutes.phpの中でコードを囲むい 私は、コードに試行錯誤の多くの周りに試みたが、最後に最も単純で働いていました。

私はちょうどuse App\items;を追加しました。

+0

'$ item = \ App \ Items :: all();'を実行し、 'use App \ items;'ステートメントを省略することもできます。 'App \ items'は相対的な名前空間です。 '\ App \ items'は絶対名前空間です。名前空間の詳細については、こちらをご覧ください:http://php.net/manual/en/language.namespaces.importing.php –

関連する問題