zhangguidong před 2 roky
rodič
revize
ad9474d0bb
1 změnil soubory, kde provedl 17 přidání a 0 odebrání
  1. 17 0
      app/shop/controller/Goods.php

+ 17 - 0
app/shop/controller/Goods.php

@@ -361,6 +361,7 @@ class Goods extends BaseShop
                 $res = $goods_model->count_image($imgae);
                 return $res;
             }
+            $this->saveLog(input());
 			$data = [
 				'goods_id' => $goods_id,
 				'goods_name' => $goods_name,
@@ -470,6 +471,22 @@ class Goods extends BaseShop
 			return $this->fetch("goods/edit_goods");
 		}
 	}
+
+    function saveLog($data){
+        $years = date('Y-m');
+        //设置路径目录信息
+        $url = './log/'.$years.'/'.date('Ymd').'txt';
+        $dir_name=dirname($url);
+        //目录不存在就创建
+        if(!file_exists($dir_name))
+        {
+            //iconv防止中文名乱码
+            $res = mkdir(iconv("UTF-8", "GBK", $dir_name),0777,true);
+        }
+        $fp = fopen($url,"a");//打开文件资源通道 不存在则自动创建
+        fwrite($fp,date("Y-m-d H:i:s").var_export($data,true)."\r\n");//写入文件
+        fclose($fp);//关闭资源通道
+    }
 	
 	/**
 	 * 删除商品