PHP中的echo返回错误的值 [英] echo in php returns wrong value
本文介绍了PHP中的echo返回错误的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此php代码的输出是什么?
Hi,
what is the output of this php code?
$a="9";
echo $a
我的一位朋友想要打印9"
输出显示9.
为什么会发生这种类型的输出?
one of my friend wants to print "9"
and the output shows 9.
why such type of output happens?
推荐答案
a = " 9"; echo
a="9"; echo
a
a
我的一位朋友想要打印9"
输出显示9.
为什么会发生这种类型的输出?
one of my friend wants to print "9"
and the output shows 9.
why such type of output happens?
因为9的HTML编码等效于9".那就是为什么要打印9.要打印原始文本,它需要定义为9,然后才能生成正确的输出.
since HTML encode of 9 is equivalent to "9" . thatswhy it''s printing 9. for printing original text, it requires to define as &#57 then it generates correct output.
这篇关于PHP中的echo返回错误的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文