html代碼
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>ansys教程</title>
</head>
<body>
<img src="/info.php教程" width="22" height="30" />
</body>
</html>
php代碼
$db = new sqlite3('mysql教程itedb.db');
//獲取文件2進制流
$filename = "/www.bKjia.c0m/logo.gif";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize ($filename));
fclose($handle);
//創建數據表
$db->exec('create table person (idnum text,name text,photo blob)');$stmt = $db->prepare("insert into person values ('41042119720101001x', '張三',?)");
$stmt->bindvalue(1, $contents, sqlite3_blob);
$stmt->execute();
<?php
$pdo = new sqlite3('mysqlitedb.db');
$results = $pdo->query('select * from person');
while ($row = $results->fetcharray()) {
ob_start();
header("content-type: image/jpg");
echo $row['photo'] ;
ob_end_flush();
}
?>