这就是我得到下面数组的方式。
$moviess = VideoLibrary::getMovies(
array("properties" => array()
));
array(275) { [0]=> object(stdClass)#68 (2) { ["label"]=> string(16) "2 Fast 2 Furious" ["movieid"]=> int(1) }
[1]=> object(stdClass)#351 (2) { ["label"]=> string(6) "2 Guns" ["movieid"]=> int(2) }
[2]=> object(stdClass)#352 (2) { ["label"]=> string(12) "3:10 to Yuma" ["movieid"]=> int(12) }
[3]=> object(stdClass)#353 (2) { ["label"]=> string(1) "9" ["movieid"]=> int(3) }
[4]=> object(stdClass)#354 (2) { ["label"]=> string(9) "10,000 BC" ["movieid"]=> int(4)
我试图从该数组中检索电影 ID
将其添加到下面的代码中
$indexdetails = VideoLibrary::getMovieDetails({**I NEED THE movieID HERE FROM THAT ARRAY**}, array(
'title',
'genre',
'year',
'rating',
'tagline',
'plot',
'mpaa',
'cast',
'imdbnumber',
'runtime',
'streamdetails',
'votes',
'thumbnail',
'trailer',
'file',
'playcount'
));
这种作品:
$movies = VideoLibrary::getMovies($requestParameters);
foreach($movies as $mv)
{
$indexdetails = VideoLibrary::getMovieDetails($mv->movieid, array(
'title',
));
var_dump($indexdetails);
}
但是当我尝试时,echo $mv->title;
我得到了 str 错误。当我尝试时,$mv['title']
我得到了不同的东西:
PHP 致命错误:不能将 stdClass 类型的对象用作数组