[英]How do i make div content downloadable to txt file?
My website generates a unique key(password) for each account to login. 我的网站为每个要登录的帐户生成唯一的密钥(密码)。 It is important, confidential, and unrecoverable.
这是重要,机密且不可恢复的。 So how do I make it downloadable as txt for everyone.
因此,如何使每个人都可以txt格式下载该文件。
This the code: 这段代码:
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>
Mainly this one: 主要是这个:
"<div class='button special'>Your Userkey: <font color='black'>$rdecrypted_text</font></div>"; ?>
I want a button below that so people click on it and it downloads a txt file containing this userkey
. 我想要一个下面的按钮,以便人们单击它,它会下载一个包含此
userkey
的txt文件。
You can put this code in a PHP file
, eg userkeydl.php
: 您可以将此代码放在一个
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.