情况:在数组中有160个ID,需要建立xml请求,最多50个集合并分别提交每个集合。PHP:每50个项目的循环函数
问题:如何循环功能,并与ID 51功能doBatch($ IDS)
简化的代码继续:
function doBatch($ids)
{
$start = "<feed>";
foreach($ids as $id)
{
$add .= '<entry>'$id.'</entry>';
}
$stop = "</feed>";
$data = $start.$add.$stop;
post($data);
}
是数字索引的$ ids数组? – stillstanding 2010-10-08 13:31:25
您是否问如何在应用程序实例之间保持状态,以便每次运行脚本时都会批量处理下一组50个ID?或者这个程序只运行一次,并且简单地多次调用'doBatch'? – meagar 2010-10-08 13:43:11
ID是Youtube视频ID(如Ez_XAQKUiL8)。 该脚本将运行一次,并将多次调用doBatch – MeProtozoan 2010-10-08 13:46:16