Home>Article>Backend Development> PHP method to determine session failure

PHP method to determine session failure

藏色散人
藏色散人 Original
2022-10-28 10:40:57 1815browse

php method to determine session failure: 1. Open the "php.ini" configuration file and find "upload_tmp_dir"; 2. Create a tp directory; 3. Restart apache; 4. Log in again.

PHP method to determine session failure

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

php method to determine session invalidation

php method to verify session invalidation

1. Problem

Today I struggled for a long time when configuring the apache php environment. Later, I succeeded but found that the verification code image could be generated. During the login verification, I found that the session was empty and had no value.

2. Solution

Environment: apache php

The program code is as follows:

The code is as follows:

   

Process the file after submission The code of this post.php file

is as follows:

if($_SESSION['ssioner']!=$ssever){ echo("");exit; }

It turns out that it keeps prompting that the verification code must consist of 4 digits, and then prints out the session:

The code is as follows:

echo $_SESSION['ssioner']; exit;

has always been empty, so I thought of a session file directory in the php environment configuration. Now we find the php.ini configuration file and find

upload_tmp_dir

and find that this directory is

upload_tmp_dir="D:\www.phpstudy.net\tp"

I checked my D drive and found that there was only the www.phpstudy.net file but no tp directory. The problem was found. Then I created a tp directory, restarted apache and found that there was the sess_i40gl0p4hfep5r69j67o1k26d01 file in the tp directory. Then I tried again. The login was found to be successful.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of PHP method to determine session failure. For more information, please follow other related articles on the PHP Chinese website!

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