當我創建一個laravel項目時,一切順利,作曲家。但是,當我嘗試訪問默認的index.php頁面時,我得到一個500錯誤。檢查日誌後,我發現它是Laravels源代碼中的語法錯誤。我發現它是'...'的變量前面。Laravel項目創建問題
[Wed Nov 02 01:47:45.658110 2016] [:error] [pid 4561] [client 70.66.236.55:55751] PHP Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /var/www/html/proj-dir/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 475
修復後會彈出一個新的。這又重複了幾次。不知道他們是否應該在那裏,但我認爲'... $ args'不是一個有效的語法(即使對於laravel)
「修復」後,我得到了一個實際錯誤信息在瀏覽器中!
`
> ErrorException in Gate.php line 132:
> Missing argument 2 for Illuminate\Auth\Access\Gate::policy(), called in
> /var/www/html/proj-dir/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php
> on line 237 and defined
> 1. in Gate.php line 132
> 2. at HandleExceptions->handleError('2', 'Missing argument 2 for Illuminate\Auth\Access\Gate::policy(), called in
> /var/www/html/proj-dir/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php
> on line 237 and defined',
> '/var/www/html/proj-dir/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php',
> '132', array('class' => array('App\Model',
> 'App\Policies\ModelPolicy'), 'this' => object(Gate))) in Gate.php line
> 132
> 3. at Gate->policy(array('App\Model', 'App\Policies\ModelPolicy')) in Facade.php line 237
> 4. at Facade::__callStatic('policy', array('App\Model', 'App\Policies\ModelPolicy')) in AuthServiceProvider.php line 25
> 5. at Gate::policy('App\Model', 'App\Policies\ModelPolicy') in AuthServiceProvider.php line 25
> 6. at AuthServiceProvider->registerPolicies() in AuthServiceProvider.php line 26
> 7. at AuthServiceProvider->boot()
> 8. at call_user_func_array(array(object(AuthServiceProvider), 'boot'), array()) in Container.php line 508
> 9. at Container->call(array(object(AuthServiceProvider), 'boot')) in Application.php line 769
> 10. at Application->bootProvider(object(AuthServiceProvider)) in Application.php line 752
> 11. at Application->Illuminate\Foundation\{closure}(object(AuthServiceProvider),
> '13')
> 12. at array_walk(array(object(EventServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider),
> object(CookieServiceProvider), object(DatabaseServiceProvider),
> object(EncryptionServiceProvider), object(FilesystemServiceProvider),
> object(FoundationServiceProvider),
> object(NotificationServiceProvider),
> object(PaginationServiceProvider), object(SessionServiceProvider),
> object(ViewServiceProvider), object(AppServiceProvider),
> object(AuthServiceProvider), object(EventServiceProvider),
> object(RouteServiceProvider)), object(Closure)) in Application.php
> line 753
> 13. at Application->boot() in BootProviders.php line 17
> 14. at BootProviders->bootstrap(object(Application)) in Application.php line 203
> 15. at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment',
> 'Illuminate\Foundation\Bootstrap\LoadConfiguration',
> 'Illuminate\Foundation\Bootstrap\ConfigureLogging',
> 'Illuminate\Foundation\Bootstrap\HandleExceptions',
> 'Illuminate\Foundation\Bootstrap\RegisterFacades',
> 'Illuminate\Foundation\Bootstrap\RegisterProviders',
> 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line
> 253
> 16. at Kernel->bootstrap() in Kernel.php line 144
> 17. at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
> 18. at Kernel->handle(object(Request)) in index.php line 54
`
我已經試過多次重建項目,但總是在同一個地方結束。不確定如何繼續。
請在此處插入您的代碼,您發現錯誤。 –
您需要PHP 5.6.x來支持該功能。 – Marty
下載最新的xampp,然後再試一次。 –