Share a PHP free verification code (with code)

藏色散人
Release: 2023-04-23 17:34:02
forward
1721 people have browsed it

Preface

CAPTCHA is the abbreviation of "Completely Automated Public Turing test to tell Computers and Humans Apart", It is a public, fully automatic program that distinguishes whether the user is a computer or a human.

Share a PHP free verification code (with code)

Front-end code

  
载入中 ...
Copy after login

PHP code

appCdn = "https://cdn.kgcaptcha.com"; // 前端验证成功后颁发的 token,有效期为两分钟 $request->token = $_POST["kgCaptchaToken"]; // 当安全策略中的防控等级为3时必须填写 $request->userId = "kgCaptchaDemo"; // 请求超时时间,秒 $request->connectTimeout = 10; $requestResult = $request->sendRequest(); if ($requestResult->code === 0) { // 验签成功逻辑处理 echo "验证通过"; } else { // 验签失败逻辑处理 echo "验证失败,错误代码:{$requestResult->code}, 错误信息:{$requestResult->msg}"; }
Copy after login

Effect display

Related links

SDK open source address:github.com/KgCaptcha, by the way A demonstration:www.kgcaptcha.com/demo/

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Share a PHP free verification code (with code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:learnku.com
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!