2017-05-10 48 views
0

Controller.php中的NotFoundHttpException第269行:未找到控制器方法。如何解決此錯誤:在laravel中找不到控制器方法?

提交表單前原:

http://localhost/framework_freshway/public_html/home/setting

http://localhost/framework_freshway/public_html/home/setting

soulfy/setting.blade.php

<li> 
           <form action="../home/setting" method="post"> 
           <span class="setting-name">MENU CSS</span> 
           <!-- <form method="POST" action="/posts"> --> 
           {{ csrf_field() }} 
           <span class="setting-value center"> 
           <select name="cars"> 
            <option value="red">Red</option> 
            <option value="blue">Green</option> 
            <option value="green">Orange</option> 
            <option value="orange">Yellow</option> 
            <option value="orange">Blue</option> 
            <option value="orange">Black</option> 
            <option value="orange">White</option> 
            <option value="orange">Grey</option> 
           </select> 
           <!-- <div style="width: 150px; height: 30px;">  <input type="image" src="http://localhost/framework_freshway/public_html/images/submit.png" value="SUBMIT" width="10"> --> 
           <input type="submit" value="Submit"> 
           </span>           
           <br><br><br>  

           </form> 

          </li> 

按下提交按鈕它去這個網址後Controller.php中的NotFoundHttpException第269行:未找到控制器方法。

Route::post('/', [ 
'uses' => '[email protected]' 
]); 

Route::controllers([ 
'auth' => 'Auth\AuthController', 
'password' => 'Auth\PasswordController', 
'home'=>'HomeController', 
'member'=>'MemberController', 
'mail'=>'MailController', 
'social'=>'SocialController', 
'ajax'=>'AjaxController', 
'api'=>'ApiController', 
'timeline'=>'TimelineController', 
'setting'=>'SettingController', 
'ecommerce'=>'EcommerceController', 
'test'=>'TestController', 
]); 
+0

route not defined路線:: post('/ home/setting','SettingController @ getMenu'); – JYoThI

回答

0

它看起來像你的服務器運行幾個級別應該高。

在您的應用程序

的根目錄啓動服務器的路徑應該是再http://localhost/home/setting

home/setting將是在您的web.php路由文件相匹配的路由。

所以在這條路線的文件,你需要像Route::post('home/setting', <[email protected]>)

路線見 https://laravel.com/docs/5.3/routing#basic-routing 瞭解更多信息

HTH

0

表單動作應該是這樣的: -

<form action="{{ url('/home/setting') }}" method="post"> 
        or 
<form action="{{ action('[email protected]')}}" method="post"> 

並嘗試此路線: -

Route::match(['get', 'post'], '/home/setting', '[email protected]'); 

希望它有幫助!

相關問題