,纔有可能經一個PHP圖像中的HTML標記並將其發送給客戶端如何包裝PHP拖圖像到HTM img標籤
<?php
$a = "A";
$ima = imagecreate(100, 30);
$bg = imagecolorallocate($ima, 255, 255, 255);
$textcolor = imagecolorallocate($ima, 0, 0, 255);
imagestring($ima, 5, 0, 0, '$a, $textcolor);
imagepng($ima);
imagedestroy($ima);
像
echo '<img src='+ $ima+' alt=' ' />';
更新
<?php
$a = "A";
$b = "B";
$c = "C";
$n = "8";
$ima = imagecreate(100, 30);
$bg = imagecolorallocate($ima, 255, 255, 255);
$textcolor = imagecolorallocate($ima, 0, 0, 255);
imagestring($ima, 5, 0, 0, '$a, $textcolor);
header('Content-type: image/png');
imagepng($ima);
imagedestroy($ima);
$imb = imagecreate(100, 30);
$bg = imagecolorallocate($imb, 255, 255, 255);
$textcolor = imagecolorallocate($imb, 0, 0, 255);
imagestring($imb, 5, 0, 0, '$a, $textcolor);
header('Content-type: image/png');
imagepng($imb);
imagedestroy($imb);
$imc = imagecreate(100, 30);
$bg = imagecolorallocate($imc, 255, 255, 255);
$textcolor = imagecolorallocate($ima, 0, 0, 255);
imagestring($imc, 5, 0, 0, '$a, $textcolor);
header('Content-type: image/png');
imagepng($imc);
imagedestroy($imc);
$imn = imagecreate(100, 30);
$bg = imagecolorallocate($imn, 255, 255, 255);
$textcolor = imagecolorallocate($ima, 0, 0, 255);
imagestring($imn, 5, 0, 0, '$a, $textcolor);
header('Content-type: image/png');
imagepng($imn);
imagedestroy($imn);
echo '<img src="script.php?id=1" />';
echo '<img src="script.php?id=2" />';
echo '<img src="script.php?id=3" />';
echo '<img src="script.php?id=4" />';
?>
@Behseini回聲出四個圖像標籤。 '等' – Brad
而不是回聲,我相信你可以使腳本死於輸出,在功能之外返回排序 – Wargog
@Behseini你的更新仍然不會阻止你有四個圖像標籤。 – Brad