php curl 转为 x-www-form-urlencoded 方式的坑


curl_setopt($curl, CURLOPT_HTTPHEADER, array(‘Content-Type: application/x-www-form-urlencoded’));

要想以 x-www-form-urlencoded 方式发送,最关键其实是发送的数据格式。

方式from-data试发送的数据用的是array格式,而方式为 x-www-form-urlencoded 时需要用key=value&key=value的格式发送,发送的是string型的数据。

from-data数据的为:
​​​​​​$data = [
‘name’ => ‘xiaoming’,
‘sex’ => 1
];
x-www-form-urlencoded时的数据则要变为
http_build_query($data);

滚动条简记

let ele = document.getElementById( ‘iM-chat-main’ );
console.log(
Math.ceil( ele.scrollTop ), // 当前顶部被卷去的高度,为零表示到顶了
ele.scrollHeight , // 当前页面内容总高度
ele.clientHeight, // 当前容器的高度
Math.ceil( ele.clientHeight+ele.scrollTop ) // 卷去的高度+容器高度=页面内容总高度时,表示到底了
);

            let ele = document.getElementById( 'iM-chat-main' );
            console.log(
                Math.ceil( ele.scrollTop ), // 当前顶部被卷去的高度,为零表示到顶了
                ele.scrollHeight , // 当前页面内容总高度
                ele.clientHeight, // 当前容器的高度
                Math.ceil( ele.clientHeight+ele.scrollTop ) // 卷去的高度+容器高度=页面内容总高度时,表示到底了
            );

批量 ping IP

在cmd命令行运行如下命令即可:

for /L %i in (10,1,80) do ping -n 1 -w 60 172.24.240.%i | find "回复" >>pingall.txt

这一条命令是ping局域网内地址范围在172.24.240.10~172.24.240.80的所有主机。ping的结果会输出到执行命令的目录里面的pingAll.txt文件。

for 中 分别为(起始,步进,终止)

注意:运行结果是追加到pingAll.txt文件的,不会新建立pingAll.txt文件。