Home > PHP Framework > ThinkPHP > body text

Do you know how to use TP5.1 verification code in Electron-vue?

藏色散人
Release: 2021-10-15 16:00:54
forward
1801 people have browsed it

The followingthinkphp frameworkThe tutorial column will introduce to you how to use TP5.1 verification code in another project (Electron-vue). I hope it will be helpful to friends in need!

TP5.1 allows the verification code to be used in another project (Electron-vue)

Blog instructions

The information involved in the article comes from the Internet and personal summary. It is intended to summarize personal learning and experience. If there is any infringement, please contact me to delete it. Thank you!

Introduction

Generally speaking, the verification code module in TP5.1 is used for the view layer of TP5.1. It is also very convenient to use and verify, but this time I want to To be used for modules other than TP5.1, such as Electron-vue.

Official manual address

https://www.kancloud.cn/manual/thinkphp5_1/354122

The idea of ​​verification code

The verification code is probably Generate a random number on the server side, then make the random number into an image with a number, and then store the number in the session. After the client obtains the verification code based on the image, compare it. If they are the same, then verify pass.

Thoughts

So after I obtain multiple verification codes, how does the server know which verification code I am? It is known in the TP5.1 framework, but how does it know in the vue project? ? In fact, no matter which project it is in, this session is stored in the form of key-value pairs. The value is our verification code, so what about our key? That is, what is the name of our verification code? It actually gave us, when we called the verification code interface, he sent this name to the cookie of our client. If you don’t believe it, we can take a look

Do you know how to use TP5.1 verification code in Electron-vue?

So we only need to bring the cookie with it when the client passes the verification code interface.

The above is the detailed content of Do you know how to use TP5.1 verification code in Electron-vue?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template