什么是& amp用于 [英] What is &amp used for

查看:125
本文介绍了什么是& amp用于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我不知道为什么& amp; 插入,它有什么区别?

  www.testurl.com/test?param1=test&current=true 



  www.testurl.com/test?param1=test&current=true 


解决方案

& 是开始字符引用的HTML。 code>& amp; 是和号的字符引用。

& current ; 不是一个标准的字符引用,所以是一个错误(浏览器可能会尝试执行错误恢复,但不应该依赖于此)。



如果您使用字符引用来表示真实字符(例如& trade; ),那么它(™)将出现在URL中,而不是您想要的字符串。 / p>

(注意取决于HT的版本您使用的ML,您可能必须以; 结束字符引用,这就是为什么& trade = 会被视为&trade ;.如果下一个字符是非单词字符(例如 = ),但某些浏览器(Hello Internet Explorer)对此有问题,则HTML 4允许忽略它。 / p>

Is there any difference in behaviour of below URL.

I dont know why the & is inserted, does it make any difference ?

www.testurl.com/test?param1=test&current=true

versus

www.testurl.com/test?param1=test&current=true

解决方案

& is HTML for "Start of a character reference".

& is the character reference for "An ampersand".

&current; is not a standard character reference and so is an error (browsers may try to perform error recovery but you should not depend on this).

If you used a character reference for a real character (e.g. ™) then it (™) would appear in the URL instead of the string you wanted.

(Note that depending on the version of HTML you use, you may have to end a character reference with a ;, which is why &trade= will be treated as ™. HTML 4 allows it to be ommited if the next character is a non-word character (such as =) but some browsers (Hello Internet Explorer) have issues with this).

这篇关于什么是& amp用于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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