Home  >  Article  >  Backend Development  >  How to modify session_id in php

How to modify session_id in php

藏色散人
藏色散人Original
2021-09-20 11:18:242607browse

How to modify session_id in php: 1. Create a PHP sample file; 2. Add "if(isset($_GET["se"])){...}"; 3. Pass "session_id( $se);" Just set the session_id of the $se bit.

How to modify session_id in php

#The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.

How to modify session_id in PHP?

Sample code for modifying session_id in PHP

The following is the detailed code for modifying session_id in PHP. I hope it will be helpful to everyone

The code is as follows:

if(isset($_GET["se"])){
$se = $_GET["se"];
}else{
return;
}
if(!empty($se)){
echo("receive se: ".$se."</br></br>"); //接受的的session为$se
session_id($se); //设置$se位session_id
session_start(); //开启sesseion ,注意不能与上一步对调,打工告成
echo("new session id: ".session_id()."</br></br>");
echo $_SESSION[&#39;h&#39;];
}

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to modify session_id in php. 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