所以我有这种格式的输出:
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
下的command
值(28711)。
所以我把它反序化了:
$output = (array) unserialize($event->data['data']['command']);
现在,当我打印这个数组的数组键时,它给了我:
array (
0 => '' . "\0" . '*' . "\0" . 'post',
1 => 'connection',
2 => 'queue',
3 => 'delay',
4 => '' . "\0" . '*' . "\0" . 'job',
)
我应该如何访问第一个键的值?