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.
34 lines
887 B
34 lines
887 B
6 months ago
|
<?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] = 0;
|
||
|
|
||
|
$json_strings = json_encode($data);
|
||
|
|
||
|
var_dump($data);
|
||
|
|
||
|
var_dump($json_string);
|
||
|
|
||
|
file_put_contents("cart.json",$json_strings);//写入
|
||
|
|
||
|
//修改
|
||
|
|
||
|
// $json_string = file_get_contents("text.json");// 从文件中读取数据到PHP变量
|
||
|
|
||
|
// $data = json_decode($json_string,true);// 把JSON字符串转成PHP数组
|
||
|
|
||
|
// $data["001"]["a"]="aas";
|
||
|
|
||
|
// $json_strings = json_encode($data);
|
||
|
|
||
|
// file_put_contents("text.json",$json_strings);//写入
|
||
|
?>
|