PHP 调用 par2 递归的处理目录并分离文件

#!/usr/bin/php <?php function 转义引号($str) { return str_replace("'","\'",$str); } function dir_list($dir_path = '') { if(!is_dir($dir_path)) return false; $dirs = opendir($dir_path); if($dirs) { while(($file = readdir($dirs)) !== false) { if(!in_array($file,['.','..','hash'])) { //目录 if(is_dir($dir_path.'/'.$file)) { //在hash目录下建立对应目录结构,用来存储最终的

PHP 处理 PUT 请求

建立一个PUT接口 发送的HTTP头应该是 Content-Type=application/json 然后读取客户端发过来的数据 parse_str(file_get_contents('php://input'), $data); 主动请求一个PUT接口 (curl) curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($handle, CURLOPT_POSTFIELDS, $data); //设置请求体,提交数据包

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的