2015-04-21 117 views
0

我有一個關於Laravel 5.使用問題後Form::open,產生了某種錯誤:關於調用一個成員函數域()一個非對象

error : Call to a member function domain() on a non-object 

FatalErrorException in UrlGenerator.php line 440: 
Call to a member function domain() on a non-object 
in UrlGenerator.php line 440 
at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Call to a member function domain() on a non-object', 'file' => '/home/nl/Laravel/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php', 'line' => '440')) in HandleExceptions.php line 116 
at HandleExceptions->handleShutdown() 

這是我LoginCheckController.php:

<?php namespace App\Http\Controllers; 

class LoginCheckController extends BaseController { 

    public function index() 

這是我的路線:

Route::post('/LoginCheck', '[email protected]'); 

鑑於我有這樣的:

{!! Form::open(array('action' => '[email protected]')) !!} 

我也跑composer dump-autoloadphp artisan clear-compiled,但我仍然得到錯誤。有什麼我忘了嗎?有明確的版本

  1. 重新安裝作曲家
  2. PHP工匠化妝:

    我解決它由控制器具有手動

+0

這是否錯誤發生在什麼文件和行? – deceze

+0

像上面的錯誤謝謝。 – nlstduio

+0

你需要告訴我們你使用的是什麼版本。 GitHub的5.0分支上的最新版本沒有與440行相關的任何內容:https://github.com/laravel/framework/blob/5.0/src/Illuminate/Routing/UrlGenerator.php#L440還尋找通話爲'domain'(' - >域(')沒有返回在該文件中有關:https://github.com/laravel/framework/search?utf8=%E2%9C%93&q=-%3Edomain%28 –

回答

0

首先更新您的laravel框架包,看着你在後面跟着跑就行了。

其次,在Laravel 5中,一切都在App命名空間中,您的控制器在App\Http\Controllers\中。路由是因爲命名空間的工作是在RouteServiceProvider設定。

嘗試使用action時添加在您的模板命名空間,或使用命名的路線是這樣的:

Route::post('/LoginCheck', ['uses' => '[email protected]', 'as' => 'login.check.index']); 

{!! Form::open(['route' => 'login.check.index']) !!} 
+0

對不起,感謝您的幫助,但仍然無法正常工作,或者我不知道如何使用它爲參考>< – nlstduio

+0

你更新laravel包? 可以給一個示例代碼?在你的終端運行'作曲家update'。而你得到同樣的錯誤還是其他什麼東西? – Robert

+0

現在出現跟隨聯合〜 在compile.php中的RouteCollection-> methodNotAllowed(array('POST'))中的Route_Collection.php行7717_ 行7713 line 7691 at RouteCollection-> match(object(Request))in compiled-php line 6965 at Router-> findRoute(object(Request))in compiled。php line 6937 – nlstduio

相關問題