How to add line breaks in RSS feeds?

后端 未结 4 1579
灰色年华
灰色年华 2020-12-17 02:03

I\'m building my own custom RSS feed in PHP. I want the tag to contain line breaks to make the text more readable. However, I can\'t seem to figure out how to do it correct

4条回答
  •  悲&欢浪女
    2020-12-17 02:28

    The RSS specification states that yes, you can use HTML in a description, but of course it needs to be properly escaped because it is embedded in XML. So using a
    is the right idea, but you need to encode it using either of these methods, take your pick:

    first line<br>second line
    
    second line]]>
    

提交回复
热议问题