2016-05-11 128 views
1

當通過本地服務器加載Laravel時,出現'文件錯誤意外結束。在我的路線,我有:Laravel - 文件意外結束

<?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. 
| 
*/ 
/* 
|-------------------------------------------------------------------------- 
| 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::post('/item/create', ['as' => 'item.store', 'uses' => '[email protected]']); 
Route::resource('item', 'ItemController'); 

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


Route::get('/home', '[email protected]'); 
Route::post('/item', '[email protected]'); 
Route::get('/item', '[email protected]'); 
Route::get('/item/{id}', '[email protected]'); 


Route::group(['middleware' => ['web']], function(){ 
    Route::get('/addItem/{productID}', '[email protected]'); 
    Route::get('/removeItem/{productID}', '[email protected]'); 
    Route::get('/checkout', function() { 
     return view('cart.checkout'); 
    }); 
    Route::post('/create_payment', function(){ 
// Set your secret key: remember to change this to your live secret key in production 
// See your keys here https://dashboard.stripe.com/account/apikeys 
     \Stripe\Stripe::setApiKey("sk_test_VVSBY8xjNklioi7V0yFVfx6Q"); 

     $receiver = \Stripe\BitcoinReceiver::create(array(
      "amount" => 1000, // amount in cents 
      "currency" => "usd", // presently can only be USD 
      "email" => "[email protected]" 
     )); 

     $charge = \Stripe\Charge::create(array(
      "amount" => $receiver->amount, 
      "currency" => $receiver->currency, 
      "source" => $receiver->id, 
      "description" => "Example charge" 
     )); 
    }); 

Route::get('/logout', 'Auth\[email protected]'); 

// Registration routes... 
Route::get('/register', 'Auth\[email protected]'); 
Route::post('/register', 'Auth\[email protected]'); 

}); 


//Route 

和我的歡迎模板我有這樣的:

@extends('layouts.app') 

@section('content') 
<div class="container"> 
    <div class="row"> 
     <div class="col-md-10 col-md-offset-1"> 
      <div class="panel panel-default"> 
       <div class="panel-heading">Welcome</div> 

       <div class="panel-body"> 
        Your Application's Landing Page. 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 
@endsection 

Laravel報告文件的意外結束的一個錯誤。我不明白爲什麼會發生這種情況。據我所知我的刀片文件是準確的,但由於某種原因,它不會呈現歡迎頁面。

+0

您是否檢查過layouts.app佈局? – suarsenegger

+0

這可能是您修改過的另一個文件的問題。也許是配置文件或服務提供者。 Linting你的路由文件表明沒有錯誤'php -l routes.php' - >'在abc.php中沒有檢測到語法錯誤' –

+0

你能發佈錯誤嗎? – Laerte

回答

2

我想出了這個問題。我想使用@extends('add')而不是layout.app。現在一切正常。