Пример #1
0
 /**
  * 获取缓存sessin数据
  * @param $id 衣服id
  * @param $type 谁用 例:clothesVoid
  * @return 成功返回json数据,否则返回false
  */
 public static function SessionGet($id = 0, $type = '')
 {
     $id = trim($id);
     $type = trim($type);
     //		print_r($type.$id);exit();
     try {
         Comm::checkValue($id, 'ID', 1, 1);
         Comm::checkValue($type, '', 0, 1);
     } catch (Exception $e) {
         return false;
     }
     if ($id == 999999999) {
         $id = session_id();
     }
     if (isset($_SESSION[$type . $id])) {
         $json_data = $_SESSION[$type . $id];
         try {
             unset($_SESSION[$type . $id]);
         } catch (Exception $e) {
         }
         $json_data = trim($json_data);
         if (!empty($json_data)) {
             $arr = json_decode($json_data, true);
             if (count($arr) > 0) {
                 $arr = Comm::array_multi2single($arr);
                 //将多维数组转一维
                 array_unique($arr);
                 //去重
                 Imgcaches::imgCacheDeleteByimg($arr);
                 //从数组中删除数据
             }
             return $json_data;
         }
     }
     return false;
 }