日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

PHP生成RSS文件類實例_PHP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:php實現(xiàn)兩表合并成新表并且有序排列的方法
具體實現(xiàn)方法如下: 代碼如下:?php /** la (3,5,8,11) lb(2,6,8,9,11,15) 合并為lc,有序排列。 用php實現(xiàn),不能用sort之類的函數(shù)�。。。� **/ class union { var $lista = array(); var $listb = array(); var $listc = array(); function getlenght($arr

 PHP RSS 生成類實例代碼如下:

代碼如下: <?php
if (defined('_class_rss_php')) return;
define('_class_rss_php教程',1);
/**
 
 *  使用說明:
 *  $rss = new rss('redfox','http://jb51.net/',"redfox's blog");
 *  $rss->additem('rss class',"http://www.jb51.net","xxx",date());
 *  $rss->additem(...);
 *  $rss->savetofile(...);
 */
 
class rss {
   //public
   $rss_ver = "2.0";
   $channel_title = '';
   $channel_link = '';
   $channel_description = '';
   $language = 'zh_cn';
   $copyright = '';
   $webmaster = '';
   $pubdate = '';
   $lastbuilddate = '';
   $generator = 'redfox rss generator';
 
   $content = '';
   $items = array();
 
   function rss($title, $link, $description) {
       $this->channel_title = $title;
       $this->channel_link = $link;
       $this->channel_description = $description;
       $this->pubdate = date('y-m-d h:i:s',time());
       $this->lastbuilddate = date('y-m-d h:i:s',time());
   }
 
   function additem($title, $link, $description ,$pubdate) {
       $this->items[] = array('titile' => $title ,
                        'link' => $link,
                        'description' => $description,
                        'pubdate' => $pubdate);
   }
 
   function buildrss() {
       $s = "<!--l version="1.0" encoding="gb2312"--> ";
       // start channel
       $s .= " ";
       $s .= " "
       $s .= "<link />{$this->channel_link} ";
       $s .= "{$this->channel_description} ";
       $s .= "{$this->language} ";
       if (!emptyempty($this->copyright)) {
          $s .= "{$this->copyright} ";
       }
       if (!emptyempty($this->webmaster)) {
          $s .= "{$this->webmaster} ";
       }
       if (!emptyempty($this->pubdate)) {
          $s .= "{$this->pubdate} ";
       }
 
       if (!emptyempty($this->lastbuilddate)) {
          $s .= "{$this->lastbuilddate} ";
       }
 
       if (!emptyempty($this->generator)) {
          $s .= "{$this->generator} ";
       }
      
       // start items
       for ($i=0;$iitems),$i++) {
           $s .= " ";
           $s .= " ";
           $s .= "<link />{$this->items[$i]['link']} ";
           $s .= "<!--data[{$thi-->items[$i]['description']}]]> ";
           $s .= "{$this->items[$i]['pubdate']} ";          
           $s .= " ";
       }
     
      // close channel
      $s .= " ";
      $this->content = $s;
   }
 
   function show() {
       if (emptyempty($this->content)) $this->buildrss();
       header('content-type:text/xml');
       echo($this->content);
   }
 
   function savetofile($fname) {
       if (emptyempty($this->content)) $this->buildrss();
       $handle = fopen($fname, 'wb');
       if ($handle === false)  return false;
       fwrite($handle, $this->content);
       fclose($handle);
   }
}
?>

分享:php查詢ip所在地的方法
具體實現(xiàn)方法如下: 代碼如下:?php /** *@ date 2010.12.21 注:文件頭 [第一條索引的偏移量 (4byte)] + [最后一條索引的偏移地址 (4byte)] 8字節(jié) 記錄區(qū) [結(jié)束ip (4byte)] + [地區(qū)1] + [地區(qū)2] 4字節(jié)+不定長 索引區(qū) [開始ip (4byte)] + [指向記錄區(qū)的偏移地址 (3byte)]

來源:模板無憂//所屬分類:PHP教程/更新時間:2014-12-06
相關(guān)PHP教程