我正在尝试使用 wikipedia mediawiki api 来获取页面数据。查询网址是:
http://en.wikipedia.org/w/api.php?action=parse&format=json&page=Nirayam_%281991_film%29
返回的属性之一是类别:
"categories":[{"sortkey":"","*":"Telugu-language_films"},{"sortkey":"","*":"1991_films"},{"sortkey":"","*":"Indian_films"}]
json_decode 之后的 var_dump :
foreach($wiki_page_data_json->parse->categories as $cat)
{
var_dump($cat);
}
给我这个:
object(stdClass)[21] public 'sortkey' => string '' (length=0)
public '*' => string 'Telugu-language_films' (length=21)object(stdClass)[22] public 'sortkey' => string '' (length=0)
public '*' => string '1991_films' (length=10)object(stdClass)[23] public 'sortkey' => string '' (length=0)
public '*' => string 'Indian_films' (length=12)
我可以以$cat->sortkey的形式访问 public 'sortkey'
问题是 -如何访问 public '*' 中的值?