时间:2021-07-01 10:21:17 帮助过:15人阅读
Array ( [ASPSESSIONIDSQSQBTCD] => BEEFLOIDMLKMMBCCBEMHBKND [ASPSESSIONIDAQSRDDBA] => BIPEIOLDJKAPKMCDBNECGKMK )
如上所示:怎样用 php 取到 Array([ASPSESSIONIDAQSRDDBA] => BIPEIOLDJKAPKMCDBNECGKMK)
Array ( [ASPSESSIONIDSQSQBTCD] => BEEFLOIDMLKMMBCCBEMHBKND [ASPSESSIONIDAQSRDDBA] => BIPEIOLDJKAPKMCDBNECGKMK )
如上所示:怎样用 php 取到 Array([ASPSESSIONIDAQSRDDBA] => BIPEIOLDJKAPKMCDBNECGKMK)
array_slice($arr, 1, 1);
方法一:只取value
next($a);
方法二:取key和value
$ak=array_keys($a);
$av = array_values($a);
$k = $ak[1];
$v = $av[1];
如果题主想要强调“保留key构建一个新的数组”,建议这样写
$arr = ['a'=>'b', 'c'=>'d'];
$keys = array_keys($arr);
print_r([$keys[1] => $arr[$keys[1]]]);
$arr[1]
unset($arr[ASPSESSIONIDSQSQBTCD]);