我有一个数组,当我print_r时,它给了我这个:
stdClass Object ( [Title] => Captain Phillips [Year] => 2013 [Rated] => PG-13 [Released] => 11 Oct 2013 [Runtime] => 134 min )
这是我的代码:
<h2>Demarrage script torrent 1</h2>
<?php
require_once 'rss_php.php';
$rss = new rss_php;
$rss->load('http://rss.imdb.com/list/XGTJ_c0RTbQ');
$arr = $rss->getRSS();
echo $arr[rss][channel]{'title'};
echo "<br>";
foreach ($arr[rss][channel] as $val1) {
$title = $val1['title'];
if (strlen($title) > 3) {
$date = split('[()]', $title);
$title = substr($title, 0, -7);
if (stripos($date[1], "series") !== false) {
continue;
} else {
echo $title;
echo "<br>";
$poslink = stripos($val1['link'], "/tt");
$poslink = $poslink + "1";
$rest = substr($val1['link'], $poslink, -1);
$urlimg = "http://www.omdbapi.com/?i=" . $rest;
$arrimg = (json_decode(file_get_contents($urlimg)));
print_r ($arrimg);
echo"<br>";
?>
<form action="" method="POST">
<input type="hidden" name="linktube[]" id="linktube" value="<?php echo $title ?>" />
<input type="hidden" name="linktube[]" id="linktube" value="<?php echo $date[1] ?>" />
<input type="submit" value="Trailler" />
</form>
<?php
}
}
}
if (isset($_POST['linktube'])) {
$arr1 = $_POST['linktube'];
$movieName = str_replace(' ', '+', $arr1[0]);
$movieYear = $arr1[1];
$page = file_get_contents('http://www.youtube.com/results?search_query='.$movieName.'+'.$movieYear.'+trailer&aq=1&hl=en');
if ($page) {
if (preg_match('~<a .*?href="/watch\?v=(.*?)".*?</div>~s', $page, $matches))
$youtubelink = "http://www.youtube.com/v/" . $matches[1];
echo $youtubelink;
echo "<script>window.location = '$youtubelink'</script>";
} else {
echo "<b>Trailler not found</b>";
}
}
?>
我试过了:
echo $arrimg[0]['Runtime'];
echo $arrimg['Runtime']
每次我尝试打印运行时值时,它都会阻止我的代码并结束循环。我不明白是什么问题。有什么东西我做错了吗?
由于