Home > Backend Development > PHP Tutorial > php利用memcache 存session 丢数据的有关问题

php利用memcache 存session 丢数据的有关问题

WBOY
Release: 2016-06-13 12:38:47
Original
935 people have browsed it

php利用memcache 存session 丢数据的问题
先上测试代码,大家也可以测试下
index.php

<?php<br />
session_start();<br />
$method = $_GET['Method'];<br />
if(isset($_SESSION['Method'])){<br />
	$_SESSION['Method'] = $_SESSION['Method'].$method;<br />
}else{<br />
	$_SESSION['Method'] =$method;<br />
}<br />
?>
Copy after login

clent.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br />
<title>无标题文档</title><br />
</head><br />
<script type="text/javascript" src="http://127.0.0.1/?Method=1" reload="1"></script><br />
<script type="text/javascript" src="http://127.0.0.1/?Method=2" reload="1"></script><br />
<script type="text/javascript" src="http://127.0.0.1/?Method=3" reload="1"></script><br />
<script type="text/javascript" src="http://127.0.0.1/?Method=4" reload="1"></script><br />
<script type="text/javascript" src="http://127.0.0.1/?Method=5" reload="1"></script><br />
<script type="text/javascript" src="http://127.0.0.1/?Method=6" reload="1"></script><br />
<body><br />
</body><br />
</html>
Copy after login


之后大家可以打印一下SESSION看看,结果经常会丢数据。SESSION经常就记录不全。不知道是为什么,还请高手来解释下。

下面附上我的其他配置
libevent-2.0.18-stable.tar.gz 服务器端
memcached-1.4.13.tar.gz  服务器端
memcache-2.2.6.tgz PHP客户端



PHP.ini
session.save_path="tcp://192.168.234.234:11211"
session.save_handler = memcache

PHP组件
php_memcache.dll  版本是2.2.6.0

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