PHP明文打印到网页 [英] php clear text printed to webpage
问题描述
我有一个html / php脚本,它直接在页面上打印一个文本字符串。但是当我刷新页面时,文本仍然存在。我搜索了这个,并检查这个论坛,并尝试了各种建议,例如
< input autocomplete =off>
和
< body onload =document.FormName.reset();>
等。他们都没有工作。
打印字符串的php代码是(如果正则表达式匹配序列号,则执行命令else print error string):
if(preg_match($ snregex,$ sn,$ matches)){
< command>
} else {
echo无效的SN,请重新输入!;
}
我应该使用不同的方式打印字符串吗?
if(preg_match($ snregex,$ sn,$ matches)){
<命令>
} else {
// echo无效的SN,请重新输入!;
}
尝试评论回显并检查文本是否仍然存在。如果没有,每次执行else循环并打印语句。
$ b
解决方案:
if(isset($ _ POST ['submit'])&&(preg_match($ snregex, )
{
<命令>
} else {
echo无效的SN,请重新输入!;
}
I have a html/php script which prints a text string directly to the page. However when I refresh the page that text is still there. I've googled this and check this forum too and tried various suggestions e.g.
<input autocomplete="off">
and
<body onload="document.FormName.reset();">
etc. None of them work.
The php code that prints the string is (if regex matches serial number then execute command else print error string):
if (preg_match($snregex, $sn, $matches)) {
<command>
} else {
echo "Invalid SN. Please re-enter!";
}
Should I print the string using a different way that can be cleared on refresh?
if (preg_match($snregex, $sn, $matches)) {
<command>
} else {
//echo "Invalid SN. Please re-enter!";
}
try commenting the echo and check if the text is still there.
if not, every time the else loop gets executed and prints the statement.
solution:
if(isset($_POST['submit']) && (preg_match($snregex, $sn, $matches))
{
<command>
} else {
echo "Invalid SN. Please re-enter!";
}
这篇关于PHP明文打印到网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!