Why session_id cannot get the value of session

WBOY
Release: 2016-07-06 13:53:11
Original
1532 people have browsed it

Set session

<code>     $sid=session_id();
     session('uid',100);</code>
Copy after login
Copy after login

It can be set up successfully here.

Get session

<code>  session_id($sid);
  session_start();
  session('uid');//无法获取值</code>
Copy after login
Copy after login

Reply content:

Set session

<code>     $sid=session_id();
     session('uid',100);</code>
Copy after login
Copy after login

It can be set up successfully here.

Get session

<code>  session_id($sid);
  session_start();
  session('uid');//无法获取值</code>
Copy after login
Copy after login

This is embarrassing
If you want to use session, you first need session_start(), and put it in front of all statements containing session;
Use $_SESSION['name'] = 'session' when setting and modifying;

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