查看文件: index.php
大小: 2.9 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="/assets/vendor/jquery/jquery.min.js"></script> <script src="/assets/js/cookie/jquery.cookie.js"></script> <title>無標題文件</title> </head> <? //$cookieData=array( 's1q1' => 'test', 's1q2' => 'test2',); //setCookie('calcCookie', json_encode($cookieData), time()+24*60*60*1000); $data = '{"timeStamp":"1711705039272","uncode":"42656789","idno":"A126569032","sign":"DC60EC2DBDCC8316C43E564365DA6D18","customerName":"2023072818024000013","phone":"0912591892","orderCode":"","datetime":"2024-03-29","email":"","state":"0","donationCode":"","taxType":0,"sales":27000,"amount":0,"totalFee":27000,"content":"","items":[{"name":"\u3010\u958b\u8a2d\u7db2\u5e97\u30111\u5e74","money":12000,"number":1},{"name":"\u6e2c\u8a661","money":1000,"number":1},{"name":"\u6e2c\u8a661","money":1000,"number":1},{"name":"\u6e2c\u8a661","money":1000,"number":1},{"name":"\u3010\u958b\u8a2d\u7db2\u5e97\u30111\u5e74","money":12000,"number":1}]}'; $value1 = json_decode($data, true); // $decoded_json echo $value1["timeStamp"].'<br>';;//=time().rand(100,999).'<br>'; echo $value1["uncode"].'<br>';;//="42656789".'<br>'; echo $value1["idno"].'<br>';//="A126569032".'<br>'; $value = json_encode($value1); setcookie("Test1", $value, time()+3600); /* $cookie = $_COOKIE['Test1']; $decoded_json = json_decode($cookie, true); echo $decoded_json["timeStamp"].'<br>';;//=time().rand(100,999).'<br>'; echo $decoded_json["uncode"].'<br>';;//="42656789".'<br>'; echo $decoded_json["idno"].'<br>';//="A126569032".'<br>'; //echo $decoded_json["datetime"]=date('Y-m-d').'<br>'; //echo $decoded_json["email"]=$_POST['q_email'].'<br>'; print_r($decoded_json); */ if(!isset($_COOKIE['Test1'])) { echo "Cookie named '" . 'Test1' . "' is not set!"; } else { echo "Cookie '" . 'Test1' . "' is set!<br>"; //echo "Value is: " . json_decode($_COOKIE['Test1']); $cookie = $_COOKIE['Test1']; $decoded_json = json_decode($cookie, true); echo $decoded_json["timeStamp"].'<br>';;//=time().rand(100,999).'<br>'; echo $decoded_json["uncode"].'<br>';;//="42656789".'<br>'; echo $decoded_json["idno"].'<br>';//="A126569032".'<br>'; } ?> <input name="" type="button" value="click" onclick="show1()" /> <script type="text/javascript"> var user = { name: "yskin", age: 25 } $.cookie('user', user); function show1(){ $.cookie.json = true; var currentU = $.cookie('Test1'); alert('User name is ' + currentU.timeStamp); alert('User name is ' + currentU.items.length ); } //alert('交易完成'); //location.href='./'; </script>
保存
取消
返回文件列表