我需要知道如何将这行代码保存为变量(如果可能的话),这样我就可以将它放在一个包装器中以显示博客文章。如果不可能,还有其他办法吗?提前谢谢。
<img src="imageView2.php?id=<?php echo $row["id"]; ?>"/>
这是包装器:
$newtext3 = wordwrap($poets, 65, "\n", true);
这是$ poets变量(博客文章)
$poets .= "<a class='demo shareSelector' <a class='eh3' style=''
href='javascript:;' ><h2 class='eh4' href=''> Category:$category</h2><h1
style='color:cyan; text-align:center; '>$title</h1><h3 >$date</h3><h2
class='eh4'>$output</h2></a></a>
<hr>";
这是imageView2.php页面:
<?php
$conn = mysqli_connect("localhost", "root", "");
mysqli_select_db ($conn,'blog');
if(isset($_GET['id'])) {
$sql = "SELECT imageType,imageData FROM posts WHERE id=" . $_GET['id'];
$result = mysqli_query($conn,$sql) or die("<b>Error:</b> Problem on
Retrieving Image BLOB<br/>" . mysqli_error($conn));
$row = mysqli_fetch_array($result);
header("Content-type: " . $row["imageType"]);
echo $row["imageData"];
}
mysqli_close($conn);
?>