[英]How can I format RSS feed content description?
I would like format the my RSS feed content.我想格式化我的 RSS 提要内容。 Like embed some information with Description tag.就像在描述标签中嵌入一些信息一样。 I am creating Wordpress Rss feed and trying to create rss 2.0我正在创建 Wordpress Rss 提要并尝试创建 rss 2.0
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<item>
<title>firstquestion</title>
<url>test-domain.com</url>
<description>This is some ifnormation on the description. The below are the answers for the new question</description></item>
</channel>
</rss>
Now, I want to format or further some table or information to be attached with special characters, even html tags formatting in the <description>
... How can I do that?现在,我想格式化或进一步格式化一些表格或信息以附加特殊字符,甚至是<description>
中的 html 标签格式化......我该怎么做?
When I simply insert, it gives me an error?当我简单地插入时,它会给我一个错误?
You can have HTML inside the description element, but you have to encode it using htmlspecialchars .您可以在描述元素中包含 HTML ,但您必须使用htmlspecialchars对其进行编码。
$description = '<strong>Strong formatting</strong> or <em>emphasis</em>.';
$item = '<item>
<title>firstquestion</title>
<url>test-domain.com</url>
<description>'.htmlspecialchars($description).'</description>
</item>';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.