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,'
','');
?>
=$id?>.=$title?>
------解决方案--------------------
$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 />}
------解决方案--------------------
$ids = $_GET;
$idsArray = explode(',' , $ids);
$titleArray;
foreach($idsArray as $key=>$idItem)
{
$url = "http://www.****.com/".$idItem.".htm";
$content = file_get_contents($url);
$titleArray[] = get_word($content,'','');
}
foreach($titleArray as $key=>$titleItem)
{
echo "$titleItem";
}
不知道是否符合你的要求
Statement: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