作者:AlbertWen
添加时间:2017-10-26 14:17:04
修改时间:2025-11-08 20:46:42
分类:
11.PHP基础
编辑
数组是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
修改时间:2025-11-14 19:12:30
分类:
15.OpenResty_Lua
编辑
OpenResty 最主要的应用场景之一是 API Server,有别于传统 Nginx 的代理转发应用场景,API Server 中心内部有各种复杂的交易流程和判断逻辑,学会高效的与其他 HTTP Server 调用是必备基础。
作者:AlbertWen
添加时间:2016-04-17 17:45:20
修改时间:2025-10-21 18:10:17
分类:
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
修改时间:2025-11-03 23:49:27
分类:
18.系统设计/UML建模
编辑
作者:AlbertWen
添加时间:2017-10-29 21:00:06
修改时间:2025-10-29 14:48:03
分类:
21.Golang编程
编辑
注意:这些“坑”不是bug,只是自己当时没搞明白。
用到的框架为 Beego
1、字典 map 是“引用类型”,本身就是指针,作为参数传递时,直接传 map 变量名即可(不要传 map 变量指针)。
在调用方法内,如果修改了 map 变量值,外部的 map 变量值也会被改变的!
作者:AlbertWen
添加时间:2017-12-16 00:49:34
修改时间:2025-11-04 15:56:18
分类:
杂七杂八
编辑
作者:AlbertWen
添加时间:2015-10-24 09:15:50
修改时间:2025-11-13 13:31:00
分类:
13.C/C++/Rust
编辑
安装参数:
--openssldir=OPENSSLDIR
安装目录,默认是 /usr/local/ssl 。
--prefix=PREFIX
设置 lib include bin 目录的前缀,默认为 OPENSSLDIR 目录。
作者:AlbertWen
添加时间:2015-11-22 17:45:13
修改时间:2025-11-11 10:03:26
分类:
13.C/C++/Rust
编辑
如何查看 glib库 的版本号?
因为 ldd 命令是 glibc 提供的,所以也可通过它来查看 glib版本号: ldd --version
作者:AlbertWen
添加时间:2017-10-27 19:43:25
修改时间:2025-11-11 09:37:30
分类:
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'
作者:AlbertWen
添加时间:2015-11-25 12:36:44
修改时间:2025-11-07 23:25:01
分类:
06.Linux软件安装
编辑
操作步骤如下:
1、打开虚拟机中的 Ubuntu 系统;
2、安装“增强工具”
3、设置“共享文件夹”