This question already has answers here:
How to access object properties with names like integers?

(7个答案)


4年前关闭。




$ ActionData ='{“1”:“muk”,
“2”:“好”,
“3”:“下陷”,
“formname”:“leadform1”,
“skip”:“true”
}';
$ form_field = json_decode($ ActionData);
print_r($ form_field);
echo $ form_field-> 1;

我的echo $form_field->1;错误
我在那弄错什么

最佳答案

只需在代码中添加true

$form_field = json_decode($ActionData, true);

这个对我有用

关于php - 获取特定整数元素的对象,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36996320/

10-11 11:35