You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
613 B

<?php
$num_get = $_POST['num'];
$numb = json_decode($num_get,true);
var_dump($num_get);
$code="001";//动态数据
$json_string = file_get_contents("cart.json");// 从文件中读取数据到PHP变量
$data = json_decode($json_string,true);// 把JSON字符串转成PHP数组
$data["num"][$num_get]++;
$data["num"][$num_get] = (string)$data["num"][$num_get];
$json_strings = json_encode($data,JSON_UNESCAPED_UNICODE);
var_dump($data);
var_dump($json_string);
file_put_contents("cart.json",$json_strings);//写入
?>