<code>Array ( [ASPSESSIONIDSQSQBTCD] => BEEFLOIDMLKMMBCCBEMHBKND [ASPSESSIONIDAQSRDDBA] => BIPEIOLDJKAPKMCDBNECGKMK ) </code>
如上所示:怎样用 php 取到 Array([ASPSESSIONIDAQSRDDBA] => BIPEIOLDJKAPKMCDBNECGKMK)
<code>Array ( [ASPSESSIONIDSQSQBTCD] => BEEFLOIDMLKMMBCCBEMHBKND [ASPSESSIONIDAQSRDDBA] => BIPEIOLDJKAPKMCDBNECGKMK ) </code>
如上所示:怎样用 php 取到 Array([ASPSESSIONIDAQSRDDBA] => BIPEIOLDJKAPKMCDBNECGKMK)
array_slice($arr, 1, 1);
<code><?php $arr = array(); //your cookies $val = array_values($arr); $cookie = $val[1]; </code></code>
方法一:只取value
next($a);
方法二:取key和value
$ak=array_keys($a);
$av = array_values($a);
$k = $ak[1];
$v = $av[1];
如果题主想要强调“保留key构建一个新的数组”,建议这样写
<code>$arr = ['a'=>'b', 'c'=>'d']; $keys = array_keys($arr); print_r([$keys[1] => $arr[$keys[1]]]); </code>
<code>$arr[1] </code>
<code>unset($arr[ASPSESSIONIDSQSQBTCD]); </code>