3에서 재생', PHPWEB:'PHP 중국어 웹사이트', settings:'설정', FullScreen:'전체 화면', Speed:'속도', BrainwashingLoop:'고리', speedNormal:'정상', click_to_see:'직접 편집할 수 있는 전체 코드를 보려면 클릭하세요.', nextSection:'다음 섹션', Cancel:'취소', Confirm:'확인하다', all_lang_string:'zh|en|zh-tw|ja|ko|ms|fr|de', Next:'다음', Previous:'이전의', };
> php教程 > php手册 > php 读取rss (2)

php 读取rss (2)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
풀어 주다: 2016-06-06 20:01:23
원래의
1458명이 탐색했습니다.

meta content="text/html; charset=utf-8" http-equiv="Content-Type" ?php // The file test.xml contains an XML document with a root element // and at least an element /[root]/title. $xmlfile = date('YmdH').'.xml'; $sourcexml = 'http://medcl.n

// The file test.xml contains an XML document with a root element  

// and at least an element /[root]/title.  

$xmlfile = date('YmdH').'.xml';  

$sourcexml = 'http://medcl.net/SinaRss.aspx?uid=1562882353';  

//die($xmlfile);  

if( !file_exists($xmlfile) ) {  

echo '你是第一次访问本系统。正在初始化...';  

$str = @file($sourcexml) or die('加载文件时出错。');  

$str = join('',$str);  

$fp = fopen($xmlfile,'w') or die('写缓存失败!');  

fputs($fp,$str);  

fclose($fp);  

echo "初始化完毕。";  

}  

if (file_exists($xmlfile)) {  

$xml = simplexml_load_file($xmlfile);  

 

//print_r($xml);  

$c = &$xml->channel;  

echo ' 

 

'.$c->title.'

 

';  

echo '

 

'.$c->lastBuildDate.'
 


 

';  

$listhead = '

 

 

    

 

        

   

            

            

            

      

            

 

            

      

            

 

            

 

        

 

        ';  

        echo $listhead;  

        $k = 0;  

        foreach($c->item as $v) {  

        $k ++;  

        echo " 

        

 

            

     

            

           

            

            

            

            

            

           

            

           

        

 

        ";  

        }  

        echo ' 

    

 

序号 标题 作者 类别 评论 时间
$k $v->title $v->author $v->category 评论 $v->pubDate
 

';  

} else {  

exit('Failed to open xml file.');  

}  

?>

관련 라벨:
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿