Hai frnds我是php的新手实际上我面临编码中的以下问题,请问任何人都可以提供解决方案吗?
任何人都可以给我一个解决方案,下面是我附加的代码
<?php
$f_name = $_POST["fn"];
$id = $_POST["id1"];
echo $id;
//echo "../public_html/sites/default/files/ourfiles/$f_name";
$res2=db_query("select * from mt_files where id='".$id."' ");
$row2=db_fetch_array($res2);
$job_audio=$row2["audio_name"];
//echo $job_audio;
//$job_audi=explode("/",$job_audio);
//$job_audio=$job_audi[8];
$job_audio= "C:/xampp/htdocs/med/sites/default/files/audio/$job_audio";
//$job_audio= "C:/Documents and Settings/swuser/My Documents/$job_audio";
//echo $job_audio;
echo "<object data='$job_audio' type='application/x-mplayer2' width='150' height='45'>
<param name='src' value='$job_audio'>
<param name='autoplay' value='true'>
<param name='autoStart' value='1'>
</object> ";
$file = "../mts/sites/default/files/docs/$f_name";
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
//The download table query goes here put the $f_name in insert into with the //time varible
?>
答案 0 :(得分:3)
我也不明白,但你做不到
echo ...
在调用 header()函数之前。
这不是你的问题吗?
在任何 header()调用之前删除任何输出,它将起作用...更好