Exemple #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;
 }
Exemple #2
0
 /**
  * 上传图片
  * @param $id 品牌id
  * @param $name 上传控件名
  * @param $address 图片上传后暂存地址:指的是数组结构。例:array('dd'=>array('kk'=>'da')),要将数据保存在二维数组kk下的写法 ('dd/kk')
  * @return 返回图片路径
  */
 public static function imgUpload($id = 0, $name = '', $address = '')
 {
     $id = trim($id);
     $name = trim($name);
     $address = trim($address);
     try {
         Comm::checkValue($id, Yii::t('public', '品牌号'), 1, 1);
         Comm::checkValue($name, '', 0, 1);
         Comm::checkValue($address, '', 0, 1);
     } catch (Exception $e) {
         throw new BeubeuException($e->getMessage(), $e->getCode());
     }
     $url = uploadd::imgupload($name);
     if (strpos($url, 'http://') !== false) {
         Imgcaches::imgCacheAdd($url);
         uploadd::SessionAdd($id, self::$Img_Session_name, $url, $address);
     }
     return $url;
 }