JQuery 调用 Promise 状态改变与触发调用的记录

<html> <head> <title>Parcel Sandbox</title> <meta charset="UTF-8" /> <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script> </head> <body> <button id='btn'>Get Data</button> <script> function showError(e) { console.warn("Error", e); } function fail() { console.log("fail", arguments); } function success() { console.log("success", arguments); } function getUser(id) { return new Promise((a, b) => { if (id % 2 == 0) { a(654321); } else { b(123456); } }); } $("#btn").on("click", () => { getUser(666) //当then的

快速导出 B 站收藏夹节目列表和个人关注列表

打开一个收藏列表 例如 https://space.bilibili.com/232495155/favlist?fid=1097406455&ftype=create 然后在控制台执行(F12 - console - 粘贴 - 回车)下面的代码 剩下慢慢等 5秒钟处理一页 实现代码 function get_list () { var result = ""; $(".fav-video-list > li >a.title").each(function(){ result += $(this).text() + '<br><a

打包 Python 程序

cxfreeze比较简单,不容易出错。 cxfreeeze有几种文件形式,msi和whl。msi是安装包直接双击运行 下载地址 http://sourceforge.net/projects/cx-freeze/files/4.3.2/ whl是pyth

PHP 应用日志记录

记录日志发送给日志服务器接口 <?php $log = array(); $log['time'] = date('Y-m-d H:i:s',time()); $log['ip'] = IpHelper::realIp(); $log["REDIRECT_STATUS"] = isset($_SERVER["HTTP_HOST"])?$_SERVER["HTTP_HOST"]:''; $log['user_id'] = $_SESSION['id']; $log['session_id'] = session_id(); $log['get'] = isset($_GET) ? http_build_query($_GET):''; $log['post'] = isset($_POST) ? http_build_query($_POST):''; $log['session'] = isset($_SESSION)? http_build_query($_SESSION):''; $log["REDIRECT_STATUS"] = isset($_SERVER["REDIRECT_STATUS"])?$_SERVER["REDIRECT_STATUS"]:''; $log["HTTP_REFERER"] = isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:''; $log["HTTP_COOKIE"] = isset($_SERVER["HTTP_COOKIE"])?$_SERVER["HTTP_COOKIE"]:''; $log["REDIRECT_URL"] = isset($_SERVER["REDIRECT_URL"])?$_SERVER["REDIRECT_URL"]:''; $log["REQUEST_URI"] = isset($_SERVER["REQUEST_URI"])?$_SERVER["REQUEST_URI"]:''; $log["REQUEST_TIME_FLOAT"] = isset($_SERVER["REQUEST_TIME_FLOAT"])?$_SERVER["REQUEST_TIME_FLOAT"]:''; $log["REQUEST_TIME"] = isset($_SERVER["REQUEST_TIME"])?$_SERVER["REQUEST_TIME"]:''; $log["HTTP_USER_AGENT"]

PHP应用日志记录

记录日志发送给日志服务器接口 <?php $log = array(); $log['time'] = date('Y-m-d H:i:s',time()); $log['ip'] = IpHelper::realIp(); $log["REDIRECT_STATUS"] = isset($_SERVER["HTTP_HOST"])?$_SERVER["HTTP_HOST"]:''; $log['user_id'] = $_SESSION['id']; $log['session_id'] = session_id(); $log['get'] = isset($_GET) ? http_build_query($_GET):''; $log['post'] = isset($_POST) ? http_build_query($_POST):''; $log['session'] = isset($_SESSION)? http_build_query($_SESSION):''; $log["REDIRECT_STATUS"] = isset($_SERVER["REDIRECT_STATUS"])?$_SERVER["REDIRECT_STATUS"]:''; $log["HTTP_REFERER"] = isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:''; $log["HTTP_COOKIE"] = isset($_SERVER["HTTP_COOKIE"])?$_SERVER["HTTP_COOKIE"]:''; $log["REDIRECT_URL"] = isset($_SERVER["REDIRECT_URL"])?$_SERVER["REDIRECT_URL"]:''; $log["REQUEST_URI"] = isset($_SERVER["REQUEST_URI"])?$_SERVER["REQUEST_URI"]:''; $log["REQUEST_TIME_FLOAT"] = isset($_SERVER["REQUEST_TIME_FLOAT"])?$_SERVER["REQUEST_TIME_FLOAT"]:''; $log["REQUEST_TIME"] = isset($_SERVER["REQUEST_TIME"])?$_SERVER["REQUEST_TIME"]:''; $log["HTTP_USER_AGENT"]