Php <<< operator


<?php

// IE - 200 OK
// Chrome - text/plain, 200 OK
// FF - application/rss+xml, 200 OK
header("Content-Type: application/rss+xml");

// IE - 200 Ok
// Chrome - application/rss+xml, 200 OK
// FF - text/html, 200 OK
//header("Content-Type: text/xml");

// be careful with the end 'RSS;', or will get 500 Error
// 1. no space before or after it, like ' RSS;' or 'RSS; '
// 2. must add a new line after it

echo $xmlstr = <<<RSS
<?xml version="1.0"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>x</title>
<link>x</link>
<description>x</description>
<language>x</language>
<copyright>x</copyright>
<generator>x</generator>
<managingEditor>x</managingEditor>
<webMaster>x</webMaster>
<ttl>0</ttl>

<item>
<title>Bringing Cutting-Edge Skills to Philippines Public Schools</title>
<link>http://www.austraining.com.au/newsandstories/120</link>
<description>Imagine teaching a computer class with fifty-five (55) students sharing about ten almost obsolete computers. While to others this herculean task might sound impossible, this is a usual daily routine for Anwar, a high school teacher in a public school nestled in a disadvantaged community in southern Philippines.</description>
<pubDate>Thu, 10 Jun 2010 12:00:00 GMT</pubDate>
<media:thumbnail url="http://www.xxx.com.au/rssfeeds/attachments/view/anwar.jpg" width="144" height="108" time="16:37:27" />
</item>
</channel>
</rss>
RSS;
// there must be a new line after it, can't delete this line
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值