在后台中直接打印fread()函数结果 显示不出来,json_encode到前台也拿不到结果。请问这是什么情况
test.php文件:
<!DOCTYPE html>
$(function(){ $.post('jiekou.php',function(data){ console.log(data); }); });
jiekou.php文件:
<?php
$path = './listed_12-1.pdf';
$fd = fopen($path, 'rb');
$file_buffer = fread($fd, filesize($path));
fclose($fd);
echo json_encode($file_buffer);exit;
?>