Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 取消序列化()后的奇数数组键_Php_Arrays - Fatal编程技术网

Php 取消序列化()后的奇数数组键

Php 取消序列化()后的奇数数组键,php,arrays,Php,Arrays,所以我有一些这种格式的输出: array ( 'job' => 'Illuminate\\Queue\\CallQueuedHandler@call', 'data' => array ( 'commandName' => 'App\\Jobs\\SampleJob', 'command' => 'O:21:"App\\Jobs\\SampleJob":5:{s:10:"' . "\0" . '*' . "\0" . 'post";O:45:

所以我有一些这种格式的输出:

array (
  'job' => 'Illuminate\\Queue\\CallQueuedHandler@call',
  'data' => 
  array (
    'commandName' => 'App\\Jobs\\SampleJob',
    'command' => 'O:21:"App\\Jobs\\SampleJob":5:{s:10:"' . "\0" . '*' . "\0" . 'post";O:45:"Illuminate\\Contracts\\Database\\ModelIdentifier":2:{s:5:"class";s:18:"App\\Models\\Post";s:2:"id";i:28711;}s:10:"connection";N;s:5:"queue";N;s:5:"delay";N;s:6:"' . "\0" . '*' . "\0" . 'job";N;}',
  ),
)  
我需要访问
命令下的
id
值(28711)

所以我取消了它:

$output = (array) unserialize($event->data['data']['command']);
现在,当我打印这个数组的数组键时,它会给出:

array (
  0 => '' . "\0" . '*' . "\0" . 'post',
  1 => 'connection',
  2 => 'queue',
  3 => 'delay',
  4 => '' . "\0" . '*' . "\0" . 'job',
)  

如何访问第一个键的值?

当我尝试取消序列化该数组时,我只得到一个错误(注意)和
false
作为输出。当我尝试取消序列化该数组时,我只得到一个错误(注意)和
false
作为输出。