我这样做了。这是对的吗?
$filename = "../pdfs/reactjs_tutorial.pdf";
$handle = fopen($filename, 'rb');
$contents = fread($handle,filesize($filename));
fclose($handle);
$encoded = chunk_split(base64_encode($contents));
/*This is how I have done*/
答案 0 :(得分:0)
$query1 = mysqli_query($con, "SELECT `offer_id` , `offer_img_url` , `terms` FROM `offers` LEFT JOIN system ON system.shop_id = offers.shop_id LEFT JOIN bill ON bill.sys_id = system.sys_id WHERE yb_id = '$yb_id' LIMIT 0 , 30 ");
if(mysqli_affected_rows($con)>0)
{
$data4 = array();
while ($row = mysqli_fetch_array($query1))
{
$data4['offer_id'] = $row['offer_id'];
$data4['offer_img_url'] = base64_encode($row['offer_img_url']);
$data4['terms'] = $row['terms'];
$data2[] = $data4;
}