将字符串数组转换为数组 php

aso*_*ahu 0 php arrays string associative

我有这样的字符串

{"status":"2","holding":"","company":"Company","nik":"8981237","name":"Markonah","ownercard":"Istri"}
Run Code Online (Sandbox Code Playgroud)

如何将此字符串转换为 PHP 中的关联数组

aid*_*nMC 7

它的 JSON,要转换为数组使用json_decode()

$string = '{"status":"2","holding":"","company":"Company","nik":"8981237","name":"Markonah","ownercard":"Istri"}';
$my_array = json_decode($string,true);
echo $my_array["status"]; // output: 2
Run Code Online (Sandbox Code Playgroud)

  • @AhmadSopian 如果这解决了您的问题,请单击“复选标记”以接受此答案。 (2认同)