[英]How do i make div content downloadable to txt file?
我的網站為每個要登錄的帳戶生成唯一的密鑰(密碼)。 這是重要,機密且不可恢復的。 因此,如何使每個人都可以txt格式下載該文件。
這段代碼:
echo '<h2>';
print "Welcome $username to your dashboard<br>";
}
echo "</h2>";
echo "<p>";
$sec_value = 'usqi3289';
$rdecrypted_text = mcrypt_ecb(MCRYPT_DES, $sec_value, $userkey, MCRYPT_DECRYPT);
echo "<div class='button special'>Your Userkey: <font color='black'>$rdecrypted_text</font></div>";
?>
<br><p align="center">Please save your Userkey first,This is confidential and unrecoverable, because we don't hold any passwords. </p>
主要是這個:
"<div class='button special'>Your Userkey: <font color='black'>$rdecrypted_text</font></div>"; ?>
我想要一個下面的按鈕,以便人們單擊它,它會下載一個包含此userkey
的txt文件。
您可以將此代碼放在一個PHP file
,例如userkeydl.php
:
<?php
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename = userkey.txt");
print "Your Userkey is: \n";
print $rdecrypted_text;
print "\nPlease note that this is confidential and unrecoverable.";
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.