search
HomePHP FrameworkThinkPHPAbout TP6 verification code and session

The following is the thinkphp framework tutorial column to introduce you to the verification code and session of TP6. I hope it will be helpful to friends in need!

When using the tp6 verification code today, I did the login verification. The verification code reports an error, and life and death prompts that the verification code failed.

After some testing, I found out that the tp6 session is not enabled by default. Need to manually uncomment.

About TP6 verification code and session

The relationship between verification code and session.

In fact, he saved the content of the verification code in the session, so if you use the verification code, you must open the session.

This is his Captcha class
You can see that he first injected a session class into the constructor to create a session object and save it. Later session operations will rely on this object.

About TP6 verification code and session

As you can see in his method of creating a verification code, he stored a 'captcha' key into the session through the session object.

About TP6 verification code and session

When he is verifying the verification code:

First get the verification code information stored in the session.

About TP6 verification code and session

This is why the session must be enabled when using the tp6 verification code. In the era before tp6, it was based on whether the session was enabled in your php.ini. In tp6, it encapsulates the implementation of session, so you need to manually open the session. Remember! ! !

The above is the detailed content of About TP6 verification code and session. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:segmentfault. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)