php代码:
<?php session_id(md5($id));//用id做为sessionid session_start(); if(!isset($_SESSION['i'])){ $_SESSION['i'] = i();//获取库存 } if($_SESSION['i'] > 0){ $buy = true; $_SESSION['i']--; }else{ $buy = false; } session_write_close(); if(isset($_COOKIE['PHPSESSID'])){//还原原来的session session_id($_COOKIE['PHPSESSID']); session_start(); }