HttpClient最基本的功能就是执行HTTP方法。HTTP方法的执行涉及到若干HTTP请求/HTTP响应的交换,通常是在HttpClient内部被处理的。使用者需要提供一个请求对象来执行,同时HttpClient需要将请求传输到目标服务器上,然后返回相应的响应对象,或者在执行不成功的时候抛出异常。
数组是PHP的灵魂,非常强大,但有时候面向对象编程也是挺方便的,数组 与 对象 之间切换也是常有的事:
/**
* 数组 转 对象
*
* @param array $arr 数组
* @return object
*/
function array_to_object($arr) {
if (gettype($arr) != 'array') {
return;
}
foreach ($arr as $k => $v) {
if (gettype($v) == 'array' || getType($v) == 'object') {
$arr[$k] = (object)array_to_object($v);
}
}
return (object)$arr;
}
/**
* 对象 转 数组
*
* @param object $obj 对象
* @return array
*/
function object_to_array($obj) {
$obj = (array)$obj;
foreach ($obj as $k => $v) {
if (gettype($v) == 'resource') {
return;
}
if (gettype($v) == 'object' || gettype($v) == 'array') {
$obj[$k] = (array)object_to_array($v);
}
}
return $obj;
}
作者:AlbertWen
添加时间:2019-03-31 16:16:50
修改时间:2026-02-14 16:56:15
分类:15.OpenResty_Lua
编辑
OpenResty 最主要的应用场景之一是 API Server,有别于传统 Nginx 的代理转发应用场景,API Server 中心内部有各种复杂的交易流程和判断逻辑,学会高效的与其他 HTTP Server 调用是必备基础。
作者:AlbertWen
添加时间:2016-04-17 17:45:20
修改时间:2026-02-18 13:22:40
分类:06.Linux软件安装
编辑
VirtualBox 从 4.3.36 升级到 5.0.16 时,遇到 “共享文件夹挂载失败错误”:
/sbin/mount.vboxsf: mounting failed with the error: No such device
stackoverflow.com 上也有人遇到过这个问题:
http://stackoverflow.com/questions/...mounting-failed-with-the-error-no-such-device
作者:AlbertWen
添加时间:2018-11-04 16:01:22
修改时间:2026-02-20 21:14:49
分类:18.系统设计/UML建模
编辑
作者:AlbertWen
添加时间:2017-10-29 21:00:06
修改时间:2026-02-23 00:56:15
分类:21.Golang编程
编辑
注意:这些“坑”不是bug,只是自己当时没搞明白。
用到的框架为 Beego
1、字典 map 是“引用类型”,本身就是指针,作为参数传递时,直接传 map 变量名即可(不要传 map 变量指针)。
在调用方法内,如果修改了 map 变量值,外部的 map 变量值也会被改变的!
作者:AlbertWen
添加时间:2015-10-24 09:15:50
修改时间:2026-02-23 08:28:08
分类:13.C/C++/Rust
编辑
安装参数:
--openssldir=OPENSSLDIR
安装目录,默认是 /usr/local/ssl 。
--prefix=PREFIX
设置 lib include bin 目录的前缀,默认为 OPENSSLDIR 目录。
作者:AlbertWen
添加时间:2015-11-22 17:45:13
修改时间:2026-02-19 22:13:11
分类:13.C/C++/Rust
编辑
如何查看 glib库 的版本号?
因为 ldd 命令是 glibc 提供的,所以也可通过它来查看 glib版本号: ldd --version
作者:AlbertWen
添加时间:2017-10-27 19:43:25
修改时间:2026-02-18 14:35:20
分类:06.Linux软件安装
编辑
./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv
make时提示:
..................................................... ext/iconv/.libs/iconv.o(.text+0x1738): In function `zif_iconv_mime_encode': /home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1017: undefined reference to `libiconv_open' ext/iconv/.libs/iconv.o(.text+0x1756):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1031: undefined reference to `libiconv_open'