Do I really need to encode '&' as '&'?

后端 未结 15 1047
夕颜
夕颜 2020-11-22 15:10

I\'m using an \'&\' symbol with HTML5 and UTF-8 in my site\'s </code>. Google shows the ampersand fine on its SERPs, as do all the browse <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5408099190056760" data-ad-slot="7305827575" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="fly-panel detail-box" id="flyReply"> <fieldset class="layui-elem-field layui-field-title" style="text-align: center;"> <legend>15条回答</legend> </fieldset> <ul class="jieda" id="jieda"> <li data-id="111" class="jieda-daan"> <a name="item-1111111111"></a> <div class="detail-about detail-about-reply"> <a class="fly-avatar" href=""> <img src="https://www.e-learn.cn/qa/data/avatar/000/00/01/small_000000127.jpg" alt=" 爱一瞬间的悲伤 "> </a> <div class="fly-detail-user"> <a href="" class="fly-link"> <cite> 爱一瞬间的悲伤</cite> </a> <span>(楼主)</span> </div> <div class="detail-hits"> <span>2020-11-22 15:55</span> </div> </div> <div class="detail-body jieda-body photos"> <p> <p>Well, if it comes from user input then absolutely yes, for obvious reasons. Think if this very website didn't do it: the title of this question would show up as <strong>do i really need to encode ‘&’ as ‘&’?</strong></p> <p>If it's just something like <code>echo '<title>Dolce & Gabbana'; then strictly speaking you don't have to. It would be better, but if you don't no user will notice the difference.

提交回复
热议问题