Heim >Backend-Entwicklung >PHP-Tutorial >PHP读取mysql中图片的有关问题
PHP读取mysql中图片的问题
<?php<br />// pic_database_output.php By Bleakwind<br />header( "content-type: image/gif");<br />$Host = "localhost";<br />$User = "root";<br />$Password = "";<br />$Database = "mycicel";<br /><br />mysqli_connect($Host,$User,$Password) or die("Could not connect:" . mysqli_error());<br />mysqli_select_db($Database) or die("Could not select database!");<br /><br />$sql= "SELECT userbase_head FROM `userbase_tables` WHERE `userbase_id`=1";<br />$result = mysqli_query($sql) or die("Could not perform query!");<br />$row = mysqli_fetch_array($result);<br />echo $row['userbase_head'];<br />?><br />
<?php<br />// pic_database_output.php By Bleakwind<br />header( "content-type: image/gif");<br />$Host = "localhost";<br />$User = "root";<br />$Password = "";<br />$Database = "mycicel";<br /><br />mysql_connect($Host,$User,$Password) or die("Could not connect:" . mysql_error());<br />mysql_select_db($Database) or die("Could not select database!");<br /><br />$sql= "SELECT userbase_head FROM `userbase_tables` WHERE `userbase_id`=1";<br />$result = mysql_query($sql) or die("Could not perform query!");<br />$row = mysql_fetch_array($result);<br />echo $row['userbase_head'];<br />?><br />