-2
<?php
header ('Content-Type: image/png');
$img = imagecreatefrompng('http://i.imgur.com/uBaMn.png');
$color = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);
imagestring($img, 1, 20, 21, $f['5'], $color);
imagepng($img);
imagedestroy($img);
?>
<?php 
$url = "http://2006scape.com/services/hiscores/index_lite.ws?player1=boardwalk";
    $f = explode(",", file_get_contents($url));
    print_r($f);
?>

:$f['5']に注意してください

配列5をエコーアウトしようとしていますが、二重引用符または一重引用符で囲む必要があるため、機能しません。ただし、そうすると、正確にエコーアウトされます: "$f['5']"。

4

1 に答える 1

0

コードの位置を変更するだけです

$url = "http://2006scape.com/services/hiscores/index_lite.ws?player1=boardwalk";
$f = explode(",", file_get_contents($url));


header ('Content-Type: image/png');
$img = imagecreatefrompng('http://i.imgur.com/uBaMn.png');
$color = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);
imagestring($img, 5, 220, 6, "F5 : " . $f['5'], $color);
imagepng($img);
imagedestroy($img);

出力

ここに画像の説明を入力してください

于 2012-12-05T19:36:08.827 に答える