我有以下 PHP 代码:
$ep1 = $tvdb->getEpisodeById($cur->id, 'en');
var_dump($ep1);
它返回这个:
object(TvDb\Episode)#60 (17) {
["id"]=> int(4490826)
["number"]=> int(12)
["season"]=> int(3)
["directors"]=> array(0) { }
["guestStars"]=> array(0) { }
["writers"]=> array(0) { }
["name"]=> string(11) "Episode 312"
["firstAired"]=> object(DateTime)#57 (3) {
["date"]=> string(19) "2013-04-07 00:00:00"
["timezone_type"]=> int(3)
["timezone"]=> string(12) "Europe/Sofia"
}
["imdbId"]=> string(0) ""
["language"]=> string(2) "en"
["overview"]=> string(0) ""
["rating"]=> string(1) "0"
["ratingCount"]=> int(0)
["lastUpdated"]=> object(DateTime)#3 (3) {
["date"]=> string(19) "2013-01-30 22:15:41"
["timezone_type"]=> int(1)
["timezone"]=> string(6) "+00:00"
}
["seasonId"]=> int(501077)
["serieId"]=> int(161511)
["thumbnail"]=> string(0) ""
}
我想回显“日期”并写下以下内容:
$ep1 = $tvdb->getEpisodeById($cur->id, 'en');
echo ($ep1->firstAired->date);
它什么也不返回,但是当我这样做时:
$ep1 = $tvdb->getEpisodeById($cur->id, 'en');
var_dump($ep1);
echo ($ep1->firstAired->date);
在转储之后,日期显示:
object(TvDb\Episode)#60 (17) { ["id"]=> int(4490826) ["number"]=> int(12) ["season"]=> int(3) ["directors"]=> array(0) { } ["guestStars"]=> array(0) { } ["writers"]=> array(0) { } ["name"]=> string(11) "Episode 312" ["firstAired"]=> object(DateTime)#57 (3) { ["date"]=> string(19) "2013-04-07 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Europe/Sofia" } ["imdbId"]=> string(0) "" ["language"]=> string(2) "en" ["overview"]=> string(0) "" ["rating"]=> string(1) "0" ["ratingCount"]=> int(0) ["lastUpdated"]=> object(DateTime)#3 (3) { ["date"]=> string(19) "2013-01-30 22:15:41" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } ["seasonId"]=> int(501077) ["serieId"]=> int(161511) ["thumbnail"]=> string(0) "" } 2013-04-07 00:00:0
我没有这个问题:
$ep1 = $tvdb->getEpisodeById($cur->id, 'en');
echo ($ep1->name);
我希望我足够清楚,如果这是一个愚蠢的问题,我很抱歉。感谢您的时间。