<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_61711"> <div class="blockcode"> <div id="code_oOW"><ol> <li>function download_file($file){</li> <li> if(is_file($file)){</li> <li> $length = filesize($file);</li> <li> $type = mime_content_type($file);</li> <li> $showname = ltrim(strrchr($file,'/'),'/');</li> <li> header("Content-Description: File Transfer");</li> <li> header('Content-type: ' . $type);</li> <li> header('Content-Length:' . $length);</li> <li> if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { //for IE</li> <li> header('Content-Disposition: attachment; filename="' . rawurlencode($showname) . '"');</li> <li> } else {</li> <li> header('Content-Disposition: attachment; filename="' . $showname . '"');</li> <li> }</li> <li> readfile($file);</li> <li> exit;</li> <li> } else {</li> <li> exit('文件已被删除!');</li> <li> }</li> <li>}</li> </ol></div> <em onclick="copycode($('code_oOW'));">复制代码</em> </div> <br> </td></tr></table> <div class="ptg mbm mtn"> PHP</div> <div id="comment_61711" class="cm"> </div> <div id="post_rate_div_61711"></div> <br><br>