好吧,我又回來了:),但帶來了一個新問題!
我試圖讓一個按鈕,點擊後,它會做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'>
<?
謝謝你對任何人誰可以回答這個問題,我知道這是probubly一個簡單的問題,但我無法找到答案的任何地方,謝謝:)
這裏'巫婆'的目的是什麼? – Daedalus
' ...'? – Jaay
no does not work ... – RepairServices