php 禁用文本输入历史

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7540085/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:54:49  来源:igfitidea点击:

disable text input history

php

提问by Boyan Georgiev

Possible Duplicate:
How do you disable browser Autocomplete on web form field / input tag?

可能的重复:
如何在 Web 表单字段/输入标签上禁用浏览器自动完成功能?

I am building an application which will be accepting credit card data. I would like to make sure that the browser does NOT remember what has been type into the text inputs for credit card number. I tried passing the following headers:

我正在构建一个接受信用卡数据的应用程序。我想确保浏览器不记得在信用卡号的文本输入中输入了什么。我尝试传递以下标题:

header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

Still, once the page reloads, I can click the credit card text input field and it will let me see what I wrote in it before. How can I prevent this?

尽管如此,一旦页面重新加载,我可以单击信用卡文本输入字段,它会让我看到我之前在其中写的内容。我怎样才能防止这种情况?

回答by user703016

<input type="text" autocomplete="off"/>

Should work. Alternatively, use:

应该管用。或者,使用:

<form autocomplete="off" … >

for the entire form (see this related question).

对于整个表单(请参阅此相关问题)。

回答by Ryan

<input type="text" autocomplete="off" />