Php 从内爆函数获取数组值

Php 从内爆函数获取数组值,php,Php,所以我有一个变量$\u GET,它接收如下值 set=QnVzaW5lc3M=|RmluYW5jZQ== 这些值使用base64_encode()进行base64编码,然后用分隔符“”分隔。我使用内爆函数来生成set变量的值 现在的问题是,如何将set变量中的值放入一个数组并对其进行base64解码 欢迎提出任何建议。 我试过这个:- $test = array(); $test = explode('|', $_GET['set']); var_dump($test); 这会抛出不可用的值

所以我有一个变量$\u GET,它接收如下值

set=QnVzaW5lc3M=|RmluYW5jZQ==
这些值使用base64_encode()进行base64编码,然后用分隔符“”分隔。我使用内爆函数来生成set变量的值

现在的问题是,如何将set变量中的值放入一个数组并对其进行base64解码

欢迎提出任何建议。 我试过这个:-

$test = array();
$test = explode('|', $_GET['set']);
var_dump($test);
这会抛出不可用的值。
但这并没有什么区别。

这应该可以使用
foreach

$data = 'QnVzaW5lc3M=|RmluYW5jZQ==';
$result = array_map(
    'base64_decode',
    explode('|', $data)
);
var_dump($result);
// Set the test data.
$test_data = 'QnVzaW5lc3M=|RmluYW5jZQ==';

// Explode the test data into an array.
$test_array = explode('|', $test_data);

// Roll through the test array & set final values.
$final_values = array();
foreach ($test_array as $test_value) {
  $final_values[] = base64_decode($test_value);
}

// Dump the output for debugging.
echo '<pre>';
print_r($final_values);
echo '</pre>';

这应该使用foreach的

// Set the test data.
$test_data = 'QnVzaW5lc3M=|RmluYW5jZQ==';

// Explode the test data into an array.
$test_array = explode('|', $test_data);

// Roll through the test array & set final values.
$final_values = array();
foreach ($test_array as $test_value) {
  $final_values[] = base64_decode($test_value);
}

// Dump the output for debugging.
echo '<pre>';
print_r($final_values);
echo '</pre>';

分解
base64\u解码
?我想知道,如果你能做到这一点,你为什么会有问题way@knittl我试过:-echo explode(“|”),$_GET['set'],但是这对我没有帮助。是的,这只会输出
数组
,因为你不能在php中直接回显数组
分解
base64_解码
?我想知道,如果你能做到这一点,你为什么会有问题way@knittl我试过:-echo explode(“|”),$_GET['set'],但是这对我没有帮助。是的,这将只输出
数组
,因为您不能在php中直接回显数组