2010-09-04 4 views
4

я пытаюсь сделать простой канал RSS, но проблема в том, когда я запускаю файл говорит вам хотелось бы открыть RSS.php ...просто RSS Feed

вот код, может быть, им делать что-то неправильно ? Я поставил его в этом формате, чтобы увидеть, как он работает.

<?php 
header('Content-Type: application/rss+xml; charset=utf-8'); 
?> 
&#60;?xml version='1.0' encoding='ISO-8859-1'?&#62; 
<rss version='2.0'> 
<channel> 
<title>feed title</title> 
<description>this is my example</description> 
<link>http://localhost:8888/redline</link> 
<copyright>Copyright (C) 2010 sarmenhb</copyright> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item>  
</channel> 
</rss> 

ответ

11

Вы должны выдать реальный <?xml version='1.0' encoding='ISO-8859-1'?>, а не оговоренную версию. Поскольку это проблематично из-за PHP собственного <?, echo это после заголовка:

<?php 
//header('Content-Type: application/xml'); 
header('Content-Type: application/rss+xml; charset=utf-8'); 
echo '<?xml version="1.0" encoding="utf-8"?>'; 
?> 
<rss version='2.0'> 
<channel> 
<title>feed title</title> 
<description>this is my example</description> 
<link>http://localhost:8888/redline</link> 
<copyright>Copyright (C) 2010 sarmenhb</copyright> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item> 
<item> 
<title>Example 1</title> 
<description>This is the description of the first example.</description> 
<link>http://www.example.com/example1.html</link> 
<pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> 
</item>  
</channel> 
</rss> 
+1

Мне нужно, чтобы отточить свои навыки быстрого набора текста на этом MacBook, я только что получил. +1 – BoltClock