Home > Backend Development > PHP Tutorial > session的使用有关问题

session的使用有关问题

WBOY
Release: 2016-06-13 12:46:00
Original
922 people have browsed it

session的使用问题
session我看手册上面是首先开启session();
然后在一个session变量
$_SEESION['user']='user';
但是我不知道怎么用


两个页面,一个页面是login.php,登录页面,
一个是edit.php,怎么样实现在两个页面上面用同一个SESSION呢,就是登录以后才可以看到里面的内容

login.php的代码

<?php<br />
$name='vicky';<br />
$user='vicky';<br />
$passwd='001';<br />
$pwd='001';<br />
<br />
seesion_start()<br />
	<br />
if($name==$user && $passwd==$pwd){<br />
	//这个位置上面的值为true,按照道理说这里应该是执行session的,应该怎么样做呢<br />
	$_SESSION['$name']='$name';<br />
<br />
}else{<br />
	echo '请重新登录';<br />
<br />
}
Copy after login


那另外一个edit.php 页面怎么来判断这个session的ID呢
 是否也开启 seeion_start();

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