PHP中的echo返回错误的值 [英] echo in php returns wrong value

查看:69
本文介绍了PHP中的echo返回错误的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



此php代码的输出是什么?

Hi,

what is the output of this php code?

$a="&#57";

echo $a



我的一位朋友想要打印&#57"
输出显示9.

为什么会发生这种类型的输出?



one of my friend wants to print "&#57"
and the output shows 9.

why such type of output happens?

推荐答案

a = " 9"; echo
a="&#57"; echo


a
a



我的一位朋友想要打印&#57"
输出显示9.

为什么会发生这种类型的输出?



one of my friend wants to print "&#57"
and the output shows 9.

why such type of output happens?


因为9的HTML编码等效于&#57".那就是为什么要打印9.要打印原始文本,它需要定义为&#57,然后才能生成正确的输出.

since HTML encode of 9 is equivalent to "&#57" . thatswhy it''s printing 9. for printing original text, it requires to define as &#57 then it generates correct output.


这篇关于PHP中的echo返回错误的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆