gpt4 book ai didi

laravel 5.2 greggilbert/recaptcha : Please ensure that you are a human

转载 作者:行者123 更新时间:2023-12-02 10:35:29 25 4
gpt4 key购买 nike

我在 Laravel 5.2 项目中使用了 greggilbert/recaptcha。尽管表单数据有效,但提交表单后我总是收到错误消息:请确保您是人类!

我尝试了很多,但没有找到任何解决方案。你有人帮助我吗?请。

我使用了这些代码:

在表格中:

 <div class="form-group">
<div class="input-group">
{!! Recaptcha::render() !!}
</div>
</div>

要获取错误消息,

@section('message')
@if (count($errors) > 0)
<h3>Message Sending Failed!</h3>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@else
<h3>
@if(isset($heading))
{{$heading}}
@endif
</h3>
<p>
@if(isset($body))
{{$body}}
@endif
</p>
@endif

@endsection

在 Controller 中:

public function save(Request $request){

$this->validate($request, [
'Name' => 'required|max:40',
'Email' => 'email|required',
'Heading' => 'required|max:200',
'Message' => 'required|max:1000',
'g-recaptcha-response' => 'required|recaptcha',
]);

$contact = new Contact();

$contact->name = $request->Name;
$contact->email = $request->Email;
$contact->heading = $request->Heading;
$contact->message = $request->Message;

$contact->save();

$msg['heading'] = 'Thank You! for contacting us.';
$msg['body'] = 'We will try to Answer to your Query as soon as possible.';

return redirect('/contact')->with($msg);

}

在config/recaptcha.php中

'public_key'     => env('RECAPTCHA_PUBLIC_KEY', '6LfjMiETAA_Rest of the key Hidden'),
'private_key' => env('RECAPTCHA_PRIVATE_KEY', '6LfjMi_Rest of the key Hidden'),

最佳答案

问题已解决:

改变后 'curl_timeout' => 1,到'curl_timeout' => 10,在 config/recaptcha.php

关于laravel 5.2 greggilbert/recaptcha : Please ensure that you are a human,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37555841/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com