我遇到了一个错误,我正处于laravel状态。当我在localhost上运行我的代码时,我没有任何问题,但是当我将laravel放在demo服务器('https')的实时服务器中时,我得到了MethodNotAllowedHttpException错误。
这是我的路线代码
Route::post('post_reminder', function(){
$creds = array(
'email' => Input::get('email')
);
$rules = array(
'email' => 'required|email'
);
$messages = array(
'email' => 'The :attribute needs to be an real email'
);
$validator = Validator::make($creds, $rules,$messages);
if($validator->fails())
{
return Redirect::route('getReminder')->withErrors($validator);
}
else
{
return Password::remind($creds);
}
});
这是表单代码
<div id="reset_container">
{{ Form::open(array('url' => 'post_reminder')) }}
<h1 id="pass_recovery_text">Password Recovery Form</h1>
<p>
@if (Session::has('error'))
<li id="error">{{ trans(Session::get('reason')) }}</li>
@elseif (Session::has('success'))
<li id="error">An e-mail with the password reset has beensent.</li>
@endif
@foreach($errors->all() as $error)
<li id="error">{{ $error }}</li>
@endforeach
{{ Form::label('email', 'Please enter you email: ') }}
{{ Form::text('email','',array('id' => 'forgot')) }}
{{ Form::submit('Reset') }}<br /><br /><br />
{{ HTML::link('/', 'Have a account Sign-In', array('id' => 'sign-in')) }}
</p>
{{ Form::close() }}
</div>
答案 0 :(得分:1)
<div id="reset_container">
{{ Form::open(array('url' => 'post_reminder','method' => 'post')) }}
<h1 id="pass_recovery_text">Password Recovery Form</h1>
<p>
@if (Session::has('error'))
<li id="error">{{ trans(Session::get('reason')) }}</li>
@elseif (Session::has('success'))
<li id="error">An e-mail with the password reset has beensent.</li>
@endif
@foreach($errors->all() as $error)
<li id="error">{{ $error }}</li> @endforeach
{{ Form::label('email', 'Please enter you email: ') }}
{{ Form::text('email','',array('id' => 'forgot')) }}
{{ Form::submit('Reset') }}
{{ HTML::link('/', 'Have a account Sign-In', array('id' => 'sign-in')) }} </p>
{{ Form::close() }}
答案 1 :(得分:0)
您是否尝试强制通过https提供路线?
Route::post('post_reminder', array('https', function(){
$creds = array(
'email' => Input::get('email')
);
$rules = array(
'email' => 'required|email'
);
$messages = array(
'email' => 'The :attribute needs to be an real email'
);
$validator = Validator::make($creds, $rules,$messages);
if($validator->fails())
{
return Redirect::route('getReminder')->withErrors($validator);
}
else
{
return Password::remind($creds);
}
}));