我已經將pdf文件存儲到數據庫中,即blob類型。 現在我想顯示PDF像從數據庫中顯示pdf blob文件
$sqll="select * from pdff";
$query=mysql_query($sqll) or die(mysql_error());
$result=mysql_fetch_array($query);
$content=$result['pdf'];
<object data="<?php echo $content;?>" type="application/pdf" style="height:200px;width:60%"></object>
但在瀏覽器中它顯示..
> endobj 6 0 obj << /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] /ColorSpace << /Cs1 7 0 R /Cs2 10 0 R >> /ExtGState << /Gs2 34 0 R /Gs1 35 0 R >> /Font << /F1.0 31 0 R >> /XObject << /Im4 21 0 R /Im1 8 0 R /Im3 16 0 R /Im2 11 0 R /Im5 26 0 R /Im6 32 0 R /Fm3 23 0 R /Fm1 13 0 R /Fm2 18 0 R /Fm4 28 0 R >> /Properties << /Pl2 36 0 R /Pl1 37 0 R >> >> endobj 23 0 obj << /Length 24 0 R /Filter /FlateDecode /Type /XObject /Subtype /Form /FormType 1 /BBox [649 536 669 556] /Resources 25 0 R /Group << /S /Transparency /CS 10 0 R /I true /K false >> >> stream xMŽAƒ0ï}žÀĉmȹ/àÄU+Íÿ¥:(\|˜]ïî etc
,我試圖
<object data="<?php echo base64_decode($content);?>" type="application/pdf" style="height:200px;width:60%"></object>
,但沒有用......請幫助meeee
每次你使用【了'mysql_'(http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) 新代碼中的數據庫擴展 ** [小貓被世界某處扼殺](http://2.bp.blogspot.com/-zCT6jizimfI/UjJ5UTb_BeI/AAAAAAAACgg/AS6XCd6aNdg/s1600/luna_getting_strangled.jpg)**它是已棄用並已使用多年,並在PHP7中永遠消失。 如果您只是學習PHP,請花些精力學習'PDO'或'mysqli'數據庫擴展。 [從這裏開始](http://php.net/manual/en/book.pdo.php) – RiggsFolly
我一直在'yii'作爲開發人員,在'yii'之前,我只是嘗試過php,好吧。我需要幫助... – rch