php怎么循环读出多个id的内容

WBOY
Release: 2016-06-13 11:47:12
Original
965 people have browsed it

php如何循环读出多个id的内容
我的问题是URL传出多个ID比如:ABC.php?id=12345,34567,67890  
关于多个ID数组去采集这些ID内容然后在一个页面显示该怎么写啊

最后效果应该是:

  • 12345.采集的第一个ID标题

  • 34567.采集的第二个ID标题

  • 67890.采集的第三个ID标题



  • 下面就是想修改的内容,希望高手帮忙,谢谢


    $urls="http://www.****.com/".$id.".htm";
    $content =get_url_content($urls);
    $title = get_word($content,'','');<br>?><br><li>=$id?>.=$title?></li> <br><font color="#FF8000">------解决方案--------------------</font><br><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush: php">$ids=explode(',',$_GET['id']);<br />foreach($ids as $id){<br /> $urls="http://www.****.com/".$id.".htm";<br /> $content =get_url_content($urls);<br /> $title = get_word($content,'<title >','<\/title>');<br /><br /> echo "<li>".$id.".".$title."</li>";<br />}</pre><div class="contentsignin">Copy after login</div></div><br><font color="#FF8000">------解决方案--------------------</font><br><?php <br />$ids = $_GET;<br>$idsArray = explode(',' , $ids);<br>$titleArray;<br>foreach($idsArray as $key=>$idItem)<br>{<br>$url = "http://www.****.com/".$idItem.".htm";<br>$content = file_get_contents($url);<br>$titleArray[] = get_word($content,'<title>','');<br>}<br>foreach($titleArray as $key=>$titleItem)<br>{<br>echo "<li>$titleItem</li>";<br>}<br>不知道是否符合你的要求<div class="clear"> </div>
    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template