PHP session usage

巴扎黑
Release: 2023-03-02 17:20:01
Original
1045 people have browsed it

Because I studied Java before, I feel very uncomfortable using PHP to do projects now, especially the session mechanism of PHP, which feels much behind Java.

1. PHP uses session, which is identified by passing the session id on each page. The default is to pass it through cookies, so the cookie support function must be turned on in the php.ini configuration file.

2. Set session.save_path in the configuration file, which is the path where session temporary files are saved

3. Every time you need to use session in the page, you must first open session.start();

4. The receiving page of the session needs to have header('Content-type: text/html; charset=utf-8'); to pass the session id


Related labels:
php
source:php.cn
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!