Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在rss站点上添加url图标_Php_Rss - Fatal编程技术网

Php 如何在rss站点上添加url图标

Php 如何在rss站点上添加url图标,php,rss,Php,Rss,我在我的网站上有一个可用的RSS源,使用下面的代码,但我想添加的是在浏览器的url地址栏上显示我的个人图标 <?php define ('CONFIG_SYSTEM_URL','http://www.mydomain.tk/'); require_once('feedcreator/feedcreator.class.php'); $feedformat='RSS2.0'; header('Content-type: application/xml'); $rss = new Un

我在我的网站上有一个可用的RSS源,使用下面的代码,但我想添加的是在浏览器的url地址栏上显示我的个人图标

<?php define ('CONFIG_SYSTEM_URL','http://www.mydomain.tk/');

require_once('feedcreator/feedcreator.class.php');

$feedformat='RSS2.0';

header('Content-type: application/xml');

$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "daily news feed";
$rss->cssStyleSheet='';
$rss->description = 'this feed is from me';
$rss->link = CONFIG_SYSTEM_URL;
$rss->syndicationURL = CONFIG_SYSTEM_URL.'feed.php';

$articles=new itemList();  
foreach ($articles as $i) {   
    $item = new FeedItem();
    $item->title = sprintf('%s',$i->title);
    $item->link = CONFIG_SYSTEM_URL.'item.php?id='.$i->dbId;
    $item->description = $i->Subject;   
    $item->date = $i->ModifyDate;   
    $item->source = CONFIG_SYSTEM_URL;   
    $item->author = $i->User;
    $rss->addItem($item);
}

print $rss->createFeed($feedformat);

?>

如果我在区域中添加,下面的代码可以在其他PHP页面上工作,但是如果我将其添加到RSS页面,则会出现错误。如果我没有弄错的话,那是因为RSS被呈现为XML


其他页面可以使用图标,但rss不会

如果在RSS上,谁能帮我更改URL栏上的图标?谢谢。

我在这里解释可以插入主频道并与文本描述一起放置的标签

<image> sub-element of <channel> 

<image> is an optional sub-element of <channel>, which contains three required and three optional sub-elements.

<url> is the URL of a GIF, JPEG or PNG image that represents the channel.

<title> describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.

<link> is the URL of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.

Optional elements include <width> and <height>, numbers, indicating the width and height of the image in pixels. <description> contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.

Maximum value for width is 144, default value is 88.

Maximum value for height is 400, default value is 31.

<image>
    <url>http://www.snook.ca/img/rss_banner.gif</url>
    <title>Snook.ca</title>
    <link>http://www.snook.ca/jonathan/</link>
    <width>111</width>
    <height>32</height>
    <description>Snook.ca features tips, tricks, and bookmarks on web development</description>
  </image>
的子元素
是的可选子元素,其中包含三个必需子元素和三个可选子元素。
表示频道的GIF、JPEG或PNG图像的URL。
描述图像,当频道以HTML呈现时,该图像在HTML标记的ALT属性中使用。
是站点的URL,当呈现频道时,图像是指向站点的链接。(注意,实际上,图像和应具有与通道和相同的值。
可选元素包括和、数字,以像素表示图像的宽度和高度。包含HTML呈现中围绕图像形成的链接的标题属性中包含的文本。
宽度的最大值为144,默认值为88。
高度的最大值为400,默认值为31。
http://www.snook.ca/img/rss_banner.gif
斯努克
http://www.snook.ca/jonathan/
111
32
ca提供了有关web开发的提示、技巧和书签

你可以用你的动态代码试试这个。

这里我解释一下可以插入你的主频道的标签,并用文本描述放在一边

<image> sub-element of <channel> 

<image> is an optional sub-element of <channel>, which contains three required and three optional sub-elements.

<url> is the URL of a GIF, JPEG or PNG image that represents the channel.

<title> describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.

<link> is the URL of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.

Optional elements include <width> and <height>, numbers, indicating the width and height of the image in pixels. <description> contains text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.

Maximum value for width is 144, default value is 88.

Maximum value for height is 400, default value is 31.

<image>
    <url>http://www.snook.ca/img/rss_banner.gif</url>
    <title>Snook.ca</title>
    <link>http://www.snook.ca/jonathan/</link>
    <width>111</width>
    <height>32</height>
    <description>Snook.ca features tips, tricks, and bookmarks on web development</description>
  </image>
的子元素
是的可选子元素,其中包含三个必需子元素和三个可选子元素。
表示频道的GIF、JPEG或PNG图像的URL。
描述图像,当频道以HTML呈现时,该图像在HTML标记的ALT属性中使用。
是站点的URL,当呈现频道时,图像是指向站点的链接。(注意,实际上,图像和应具有与频道和相同的值。)。
可选元素包括和、数字,以像素表示图像的宽度和高度。包含HTML呈现中围绕图像形成的链接的标题属性中包含的文本。
宽度的最大值为144,默认值为88。
高度的最大值为400,默认值为31。
http://www.snook.ca/img/rss_banner.gif
斯努克
http://www.snook.ca/jonathan/
111
32
ca提供了有关web开发的提示、技巧和书签

你可以用你的动态代码试试这个。

Hi steve的可能重复,在我发布之前,我已经尝试了favicon.ico的东西,但似乎不是解决方案。我的favico.ico在根目录中。Hi steve的可能重复,在我发布之前,我已经尝试了favicon.ico的东西,但似乎不是解决方案。我有我的fav根目录中的ico.ico。你好,阿米特,谢谢你的建议。我想我把你和我关于图标的问题搞混了。我关于图标的意思是URL栏上显示的URL图标,而不是RSS上的图像。我的RSS上有图像功能,我没有包括,但我会提供参考。
code
$image=new FeedImage();$image->title='我的个人RSS徽标';$image->url='';$image->link=“”$image->description='这是我的个人RSS徽标';$image->width=20;$image->height=20;$RSS->image=$image;
code
Hi-Amit,谢谢你的建议。我想我把关于图标的问题弄糊涂了。关于图标,我指的是URL栏上显示的URL图标,而不是RSS上的图像。我有图像功能在我的RSS上,我没有包括但作为参考,我将提供。
code
$image=new FeedImage();$image->title='my Personal RSS Logo';$image->url='';$image->link=“”;$image->description='这是我的个人RSS Logo';$image->width=20;$image->height=20;$RSS->image=$image;