使用 PHP,我可以将 pdf 从一个长 blob 打印到普通浏览器,但不能打印到手机。
$sql = "SELECT * FROM bus WHERE id = '$bid' ";
$result = mysqli_query($conn, $sql) OR DIE(mysqli_error($conn));
function isMobile()
{
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up.browser|up.link|webos|wos)/i", $\_SERVER\["HTTP_USER_AGENT"\]);
}
if (isMobile())
{
while ($row = mysqli_fetch_object($result))
{
header("Content-type: ".$row-\>mimetype);
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$useragent = $\_SERVER\['HTTP_USER_AGENT'\];
header('Location: http://detectmobilebrowser.com/mobile');
print_r($row-\>pricelist);
}
}
else
{
while($row = mysqli_fetch_object($result))
{
header("Content-type: ".$row-\>mimetype);
header("Cache-Control: no-cache");
header("Pragma: no-cache");
print_r($row-\>pricelist);
}