我想编码一个数字数组。 在编码之后,我想将数据发送到另一台服务器。
$query = "***";
$arr = $wpdb->get_results($query, ARRAY_N);
print_r($arr);
print_r的结果:
[0] => Array
(
[0] => 3
[1] => i64lo2
[2] => Alex
[3] => ***
[4] => 213
[5] => 8
[6] => 0
[7] => 1
[8] => 0
[9] => 0
[10] => 1
[11] => 2015-07-24 12:17:15
[12] => 2015-07-24 12:17:15
[13] => ***@***.de
[14] => 85
[15] => 1
)
[1] => Array
(
[0] => 7
[1] => 2tvplb
[2] => Peter
[3] => ***
[4] => 213
[5] => 8
[6] => 0
[7] => 1
[8] => 0
[9] => 0
[10] => 1
[11] => 2015-07-24 12:18:51
[12] => 2015-07-24 12:18:51
[13] => ***@***.de
[14] => 85
[15] => 2
)
我的编码方法:
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
for($i = 0; $i <= count($arr); ++$i){
for($z = 0; $z <= count($arr[$i]); ++$z){
echo mcrypt_encrypt(MCRYPT_RIJNDAEL_256, "passwort", $arr[$i][$z], MCRYPT_MODE_ECB, $iv);
$z++;
}
$i++;
}
但这是如此缓慢......有人更好的想法编码一个数组? 我要在编码后解码代码。