且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP json_decode表示法问题

更新时间:2023-12-04 14:45:19

您可以在名称周围使用花括号来访问属性:

You can use braces around the name to access the property:

<?php

$o = json_decode('{"docs": [{"rssFeed.type": "news", "rssFeed.url": "http://www.example.com/",  "score": 1.0 }]}');

var_dump($o->docs[0]->{'rssFeed.url'});
?>