0
내가 Laravel내 양식이 Laravel에서 POST로 데이터를 전송하지 않는 이유는 무엇입니까?
내가 POST 방법으로 내 로그인 양식 datas를 보내 원하는 내 로그인 페이지를 만드는거야,하지만
// /view/login.blade.php
/*
{{ Form::open([
"route" => "user/login",
"autocomplete" => "off",
'method' => 'POST'
]) }}
{{ Form::label("username", "Usuário:") }}
{{ Form::text("username", Input::old("username"), [
"placeholder" => "john.smith"
]) }}
{{ Form::label("password", "Senha:") }}
{{ Form::password("password", [
"placeholder" => "*******"
]) }}
{{ Form::submit("Entrar") }}
{{ Form::close() }}
//---------------------------------------
// routes.php
Route::any('/', [
"as" => "user/login",
"uses" => "[email protected]"
]);
//---------------------------------------
// /controllers/UserController.php
class UserController extends Controller
{
public function loginAction()
{
echo Input::server("REQUEST_METHOD"); // This line is ever print "GET"
return View::make('user/login');
}
}*/
작동하지 않습니다,
// view/login.blade.php
<form action="{{URL::to('/')}}" method="post">
<input name="login" type="text"/><br/>
<input type="password" name="senha" id=""/><br/>
{{ Form::submit('Enviar') }}
</form>
// routes.php
Route::any('/', function()
{
echo Request::getMethod(); is returning GET forever
return View::make('login');
});
분명히 [코드 편집] 내 양식은 POST 메서드를 사용하여 데이터를 보내지 만 $ _POST에서 가져올 수없는 이유는 무엇입니까?
예, GET으로 데이터를 가져올 수 있지만 POST 방법이 작동하지 않는 이유는 무엇입니까? – Lai32290
@ Lai32290이 메서드를 사용하여 얻은 모든 데이터 (GET 및 POST). –
나는 테스트를 위해서만 내 코드를 단순화했다. 그러나 내 echo Request :: getMethod(); 항상 돌아 오지. 왜? – Lai32290