2018年6月

https://segmentfault.com/q/1010000015379092

分析了几天,没有结果
很是蛋痛

今天终于找到问题原因:$data 变量中 存在一个同名的data的键,程序里并且进行了两次 extract($data),第一次把data中的数据导出后,就替换掉了 $data 导致第二次导出的数据就不存在了

问题是我其他有一个页面也用了data这个键名,也没有问题,就奇怪了

我开发环境,另一个页面也是存在 同键名的值 的,却没有问题


function arrayGet($array, $key, $default = null) {
    $keys = explode('.', $key);
    $a = $array;
    while (count($keys) != 0) {
        $key = array_shift($keys);
        if(!isset($a[$key])){
            return $default;
        }
        $a = $a[$key];
    }
    return $a;
}

function arraySet(&$array, $key, $value) {
    $keys = explode('.', $key);
    if (count($keys) == 1) {
        $array[$key] = $value;
        return;
    }
    $a = array();
    $b = $array;
    while (count($keys) != 0) {
        $k = array_shift($keys);
        $b = isset($b[$k]) ? $b[$k] : array();
        $a[$k] = $b;
    }
    $ka = array_keys($a);
    $a[end($ka)] = $value;
    for ($index = count($ka) - 2; $index >= 0; $index--) {
        $k = $ka[$index];
        $nextK = $ka[$index + 1];
        $a[$k] = array_merge($a[$k], array($nextK => $a[$nextK]));
    }
    $array[$ka[0]] = $a[$ka[0]];
}

parseQueryString(url) {
    let reg_url  = /^[^\?]+\?([\w\W]+)$/,
        reg_para = /([^&=]+)=([\w\W]*?)(&|$|#)/g,
        arr_url  = reg_url.exec(url),
        ret      = {},
        str_para, result;
    if (arr_url && arr_url[1]) {
        str_para = arr_url[1]
    } else {
        str_para = url
    }
    while ((result = reg_para.exec(str_para)) != null) {
        ret[result[1]] = result[2];
    }
    return ret;
},

CentOS 7 —— /etc/rc.local 开机不执行

增加该文件的执行权限(默认没有执行权限的)
chmod +x /etc/rc.d/rc.local

然后启用这个服务
systemctl enable rc-local.service

CentOS 7 已经废弃这个了
Note: rc.local is obsolete.

另一个解决方法,就是把要执行的命令放到全局的启动文件里来执行:
/etc/bashrc

服务器端安装:
Debian / Ubuntu:
apt-get install python-pip
pip install shadowsocks

CentOS:

yum install python-setuptools && easy_install pip
pip install shadowsocks

Windows 安装教程:
https://github.com/shadowsocks/shadowsocks/wiki/Install-Shadowsocks-Server-on-Windows

启动服务:
ssserver -p 443 -k password -m aes-256-cfb

在后台运行服务:
sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start

停止服务:
sudo ssserver -d stop

查看日志:
sudo less /var/log/shadowsocks.log

客户端:
Windows
https://github.com/shadowsocks/shadowsocks-csharp

OS X
https://github.com/shadowsocks/shadowsocks-iOS/wiki/Shadowsocks-for-OSX-Help

Android
https://github.com/shadowsocks/shadowsocks-android

iOS
https://github.com/shadowsocks/shadowsocks-iOS/wiki/Help

OpenWRT
https://github.com/shadowsocks/openwrt-shadowsocks

Wiki
https://github.com/shadowsocks/shadowsocks/wiki