我在mysql数据库中有一个二进制代码,例如: 3078323535303434343632443331324533333230304132354532453343464433323030413331323033303230364636323641323030413343334332303041324635343739373036353230324634333631373436313643364636373230304132463530363136373635373332303332323033303230353232303041324635303631363736353444364636343635323032463535373336353445364636453635323030413246353636393635373736353732353037323635363636353732363536453633363537333230334333433230304132463436363937343537363936453634364637373230373437323735363532303041324635303631363736353443363137393646373537343230324635333639364536373643363535303631363736353230304132463445364636453436373536433643353336333732363536353645353036313637363534443646363436353230324635353733363534453646364536353230304133453345323030413345334532303041363536453634364636323641323030413335323033303230364636323641323030413343334332303041324634433635364536373734363832303331333533373330323030413246343636393643373436353732323035423230324634363643363137343635343436353633364636343635323035443230304133453345 3230304137333734373236353631364430413738394342443537353936464533333631303745443741463930363531444434343139394137343832414345363533423839393344443244443033363430314645323345373442334242303538413643383136453146464146373342334341343338423639334444324538324441383034303839394345463942313943453043383741343235333232364630433743343846393436314631464445373838423838463546374530463833394641453232324434384343343531373533344141343838413931343436433435463345343642463434374634363243424538393138383946463839304330383733344434394643333941323934373639443746373938303137343643333042304341353144434137313638303838394546323346463232333941373745424437424431333446364132353233303342423439303645373845464138444346303231333232323043304436313545433830464238354230373433343746314530
我尝试了file_put_contents(),但是没有用。
$TestName = $row['TestName'];
$binary = $row['PdfReport'];
$binary = base64_decode($binary);
file_put_contents($TestName.'.pdf', $binary);
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.$TestName.'.pdf"');
echo $TestName;
PDF文件已生成,但没有打开。当我打开pdf文件时,它显示了我的php文件代码。请帮忙。谢谢