Does & or & or & mean the same thing in code?

五迷三道 提交于 2021-02-16 08:27:21

问题


We have a client that uses a wordpress blog, when he pastes in our video embed code it changes &'s into & so for a workaround he has to re-write & as &

Does this break code? Would doing something like <code></code> in wordpress fix the issue?

Example:

<param name="adServerURL" value="http://plg.website.com/dynamic_preroll_playlist.vast2xml?domain=111aaabbb&amp;pubchannel=KidS&amp;" />

回答1:


Technically yes they are all the same thing. Since it's wordpress I would recommend using the &#038; as that's the encoded version of the ampersand & or &amp;.

WordPress references:

http://wordpress.org/support/topic/how-to-get-rid-of-amp-and-038

http://wordpress.org/support/topic/unwanted-characters-038




回答2:


I’m not sure of what you mean, as your text refers to changing & into &. Probably you meant changing the ampersand letter & to &amp;, but here you need to use the “{ }” button to “escape” it to make it visible.

It’s a correct change. In HTML, the ampersand has a special meaning, and this applies to occurrences in URLs, too. Mostly you can get away with it if you don’t “escape” it, but escaping is the right thing to do—failing to do so may sometimes break the code.

Using <code> markup has no impact on this.



来源:https://stackoverflow.com/questions/8511295/does-amp-or-038-or-mean-the-same-thing-in-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!