- NL: new line 一般指
\r\n
- CR: 回车carriage return
\r
- LF: 换行line feed
\n
- ESB: Enterprise Service Bus 服务总线(SOA)
- RFC: Requests For Comments 征求意见稿
- SOA: service-oriented architecture 面向服务体系架构
<?php | |
function is_json_str($str) { | |
json_decode($str); | |
return json_last_error() === JSON_ERROR_NONE; | |
} |
# 字典排序: | |
# 1. 根据key排序 | |
items = dict.items() | |
items.sort() # list 的sort属性 | |
for key,value in items: | |
print key,value | |
'''or''' | |
print key, dict[key] for key in sorted(dict.keys()) # sorted方法:从小到大排列 |
# 1. list => dict | |
arr1,arr2 = ['a', 'b'],[1,2] | |
dic = dict(zip(arr1, arr2)) # {'a':1, 'b':2} |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"log" | |
"strings" | |
) | |
<?php | |
function rolling_curl($curl_multi_data = []) | |
{ | |
$queue = curl_multi_init(); | |
$map = array(); | |
foreach ($curl_multi_data as $curl_data) { | |
$ch = curl_init(); | |
$data = $curl_data['data']; | |
if($curl_data['is_post']) |
const func = func = (...args) => {func.info(...args)}; | |
func.info = (...args) => {console.info.apply(this, args)}; | |
// test | |
func(1,2,3,4); | |
// out put: | |
// ø 1 2 3 |
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
s := []int{1,2,3,4,5} | |
nodes := append(s[:index], s[(index+1):]...) |
setTimeout(function(){ | |
console.log("timeout") | |
}, 0); | |
setImmediate(function(){ | |
console.log("immediate") | |
}); | |
process.nextTick(function(){ | |
console.log('next tick') |
<?php | |
/** | |
* Use php curl multi, rolling request url. | |
* | |
* @author [email protected] | |
*/ | |
class CurlRoll | |
{ | |
/** |