array:5 [▼
"open" => "info"
"on_hold" => "warning"
"answered" => "success"
"dev. In progress" => "success"
"closed" => "default"
];
我需要使用这个数组并只获取String的索引,如下所示
'ticket_statuses' => [
'open' => 'info',
'on_hold' => 'warning',
'answered' => 'success',
'dev. In progress' => 'success',
'closed' => 'default',
]
$array = config('settings.ticket_statuses');
$status = implode(',', $array);
dd($status);
当我使用implode($array)时,结果如下所示
"info,warning,success,success,default"
但我不需要这个
1条答案
按热度按时间bqf10yzr1#
如果只想内爆索引,比如
open
,on_hold
,那么需要使用array_keys()
方法: