Home >php教程 >php手册 >Made a great extension for thinkphp5

Made a great extension for thinkphp5

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-15 16:49:592087browse

I made a very good extension for thinkphp5 and installed it using composer

composer require lilwil/geetest
Use

Parameter configuration

To configure the geetest configuration in the configuration file, you need to apply on the official website//Example<br> 'geetest' => [<br>         'captcha_id'=>'40c653bd06de23cece65d180d94b937f',<br>        'private_key'=>'0c54bad6d2419733de49db4826d83942',<br> ],Call in the template<!--For ease of use, use the jquery.js library directly --><br> <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script><br> <!--Introducing an interface that encapsulates failback--initGeetest --><br> <script src="http://static.geetest.com/static/tools/gt.js"></script><br> <script><br> function doOk(){<br> //TODO: Verification successful, operation on the form<br> // $("#embed-submit").attr("disabled", false); <br> // $("#embed-submit").attr("style", 'background:#fe693e'); <br> }<br> var handlerEmbed = function (captchaObj) {<br> //Add the verification code to the element with id captcha<br> ​​captchaObj.appendTo("#embed-captcha");<br> ​​captchaObj.onSuccess(doOk);<br> ​​captchaObj.onReady(function () {<br> //TODO: Method to be executed after the page is loaded<br>                // $("#embed-submit").attr("disabled", true); <br>               // $("#embed-submit").attr("style", 'background:#A79995'); <br>            //$("#wait")[0].className = "hide";<br> });<br> };<br> $.ajax({<br> // Get id, challenge, success (whether failback is enabled)<br> url: "{:geetest_url()}?t=" + (new Date()).getTime(), // Add random numbers to prevent caching<br> Type: "get",<br> dataType: "json",<br> Success: function (data) {<br> //Use initGeetest interface<br> // Parameter 1: Configuration parameters<br> // Parameter 2: Callback, the first parameter of the callback is the verification code object, which can be used later to do events such as appendTo<br> initGeetest({<br>            gt: data.gt,<br> Challenge: data.challenge,<br> Product: "float", // Product form, including: float, embed, popup. Note that the verification code is only valid for the PC version<br>                                                                                                                                        Indicates that the user background detects whether the Jiqian server is down, generally no need to pay attention<br>         }, handlerEmbed);<br> }<br> });<br> </script><br> Verify in the controller<br> <br> //You need to pass in the data of $_POST request<br> if(!geetest_check($post)){<br> //Verification failed<br> };Effect
Made a great extension for thinkphp5

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn