我向服务器发出了ajax请求,并发送了一些数据(纯文本)作为查询字符串变量。在php中使用base64_decode()函数后,我将该数据保存到了文本文件中,这显然可以节省乱码。
现在,我想从保存在文本文件中的乱码数据中恢复纯文本。我怎么做?
任何帮助表示赞赏
test.php
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
data = '12345';
$.ajax({url:'sample.php?data='+data,success:function(){}});
</script>
sample.php
<?php
file_put_contents('file.txt','data='.base64_decode($_REQUEST['data'])."\r \n",FILE_APPEND);
?>