好的,我又回来了:),但有一个新问题!
我正在尝试制作一个按钮,点击后,它将location.href
对我的 download.php执行
巫术代码是:
<?
ob_start();
require_once 'includes/db.php';
require_once 'includes/init.php';
?>
<?php
$file = "logs/".$_SESSION['username'].".txt";
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');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
我的其他代码巫术初始化按钮以下载 .txt 文件:
<?php
if (isset($_POST['clearBtn']))
{
?>
< location.href = 'download.php'>
<?
echo '<div class="nNote nSuccess hideit"><p><strong>SUCCESS: </strong>Logs have been downloaded</p></div>';
}
?>
<div class="widget">
<div class="title"><img src="images/icons/dark/frames.png" alt="" class="titleIcon" /><h6>Logs</h6><form action = "" method="post" class="form">
<input type="submit" style="margin-top: 4px; margin-right:4px;" value="Download Logs" name="clearBtn" class="dblueB logMeIn" />
我如何使这部分工作:
?>
< location.href = 'download.php'>
<?
感谢任何可以回答这个问题的人,我知道这可能是一个简单的问题,但我在任何地方都找不到答案,谢谢:)