[英]Laravel 4 Form Submission and Input Retrieval
我是Laravel的初學者。 我試圖通過使用控制器來操縱輸入來制作一個簡單的登錄表單。 但是,每次代碼只是忽略控制器函數,並在每次提交時繼續調用索引。 請指教。
這是我的表格的代碼
{{ Form::open(array('action' => 'CoverController@authent')) }}
<div class="col-md-3 text-box pull-left">
{{ Form::email('email', '', array('placeholder'=>'Email')); }}
</div>
<div class="col-md-3 text-box pull-left">
{{ Form::password('password', array('placeholder'=>'Password')); }}
</div>
<div class="clearfix"> </div>
<div class="con-button">
{{ Form::submit('Sign Up / Log In'); }}
</div>
{{ Form::close() }}
以下是我的路線
Route::get('/',array('as'=>'users','uses'=>'CoverController@index'));
Route::post('/','CoverController@authent');
這是我的控制器功能
class CoverController extends BaseController {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$view = View::make('cover');
return $view;
}
public function authent()
{
$email = Input::get('email');
$pwd = Input::get('password');
$view = View::make('formoid')->with('email',$email)->with('password',$pwd);
return $view;
}
}
使用上面的代碼,每次按下登錄按鈕時,都會調用index()函數而不是authent(),我在做什么錯呢?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.