多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# index.php页面内重点 ## 1、 获取支付状态:判断是否支付成功的状态status = success ~~~ <?php $status = ''; if (isset($_GET['status']) && !empty($_GET['status'])) { $status = $_GET['status']; } ?> ~~~ ## 2、页面实现websocket ~~~ var wsServer = 'ws://192.168.33.10:9504';//ip+端口 var websocket = new WebSocket(wsServer); websocket.onopen = function (client) { websocket.send("<?php echo $status?>");//向后端发送是否成功购买的状态 }; websocket.onmessage = function (client) { //接收后端发送过来的数据【已经被购买过数据】 if (client.data) { var data = JSON.parse(client.data); sc.get(data).status('unavailable'); } }; websocket.onclose = function (client) { //是否断开连接 console.log("Disconnected"); }; websocket.onerror = function (client, e) { //错误信息 console.log('Error occured: ' + client.data); }; ~~~