都是$$$分割对应
最后$或者换行分割
最后需要得到
<li>youku</li>
<a href="1_1.html" target="_top">第一集</a>
<a href="1_2.html" target="_top">第二集</a>
<a href="1_3.html" target="_top">第三集</a>
<a href="1_4.html" target="_top">第四集</a>
<a href="1_5.html" target="_top">第五集</a>
<li>tudou</li>
<a href="2_1.html" target="_top">第一集</a>
<a href="2_2.html" target="_top">第二集</a>
<a href="2_3.html" target="_top">第三集</a>
<a href="2_4.html" target="_top">第四集</a>
<a href="2_5.html" target="_top">第五集</a>
<li>down</li>
<a href="3_1.html" target="_top">第一集</a>
<a href="3_2.html" target="_top">第二集</a>
<a href="3_3.html" target="_top">第三集</a>
<a href="3_4.html" target="_top">第四集</a>
<a href="3_5.html" target="_top">第五集</a>
------解决思路----------------------
$a = explode('$$$', $a);
$b = explode('$$$', $b);
foreach($a as $i=>$r) {
echo "<li>$r</li>\n";
foreach(explode("\n", $b[$i]) as $j=>$v) {
$t = explode('$', trim($v));
printf("<a href='%d_%d.html' target='_top'>%s</a>\n", $i+1, $j+1, $t[0]);
}
}
<li>youku</li>
<a href='1_1.html' target='_top'>第一集</a>
<a href='1_2.html' target='_top'>第一集</a>
<a href='1_3.html' target='_top'>第二集</a>
<a href='1_4.html' target='_top'>第三集</a>
<a href='1_5.html' target='_top'>第四集</a>
<a href='1_6.html' target='_top'>第五集</a>
<li>tudou</li>
<a href='2_1.html' target='_top'>第一集</a>
<a href='2_2.html' target='_top'>第一集</a>
<a href='2_3.html' target='_top'>第二集</a>
<a href='2_4.html' target='_top'>第三集</a>
<a href='2_5.html' target='_top'>第四集</a>
<a href='2_6.html' target='_top'>第五集</a>
<li>down</li>
<a href='3_1.html' target='_top'>第一集</a>
<a href='3_2.html' target='_top'>第一集</a>
<a href='3_3.html' target='_top'>第二集</a>
<a href='3_4.html' target='_top'>第三集</a>
<a href='3_5.html' target='_top'>第四集</a>
<a href='3_6.html' target='_top'>第五集</a>
但你的数据本该是这样的
$a = 'youku$$$tudou$$$down';
$b='第一集$1_1.html
第二集$1_2.html
第三集$1_3.html
第四集$1_3.html
第五集$1_5.html$$$第一集$2_1.html
第二集$2_2.html
第三集$2_3.html
第四集$2_4.html
第五集$2_5.html$$$第一集$3_1.html
第二集$3_2.html
第三集$3_3.html
第四集$3_4.html
第五集$3_5.html';
$a = explode('$$$', $a);
$b = explode('$$$', $b);
foreach($a as $i=>$r) {
echo "<li>$r</li>\n";
foreach(explode("\n", $b[$i]) as $v) {
$t = explode('$', trim($v));
echo "<a href='$t[1]' target='_top'>$t[0]</a>\n";
}
}
<li>youku</li>
<a href='1_1.html' target='_top'>第一集</a>
<a href='1_2.html' target='_top'>第二集</a>
<a href='1_3.html' target='_top'>第三集</a>
<a href='1_3.html' target='_top'>第四集</a>
<a href='1_5.html' target='_top'>第五集</a>
<li>tudou</li>
<a href='2_1.html' target='_top'>第一集</a>
<a href='2_2.html' target='_top'>第二集</a>
<a href='2_3.html' target='_top'>第三集</a>
<a href='2_4.html' target='_top'>第四集</a>
<a href='2_5.html' target='_top'>第五集</a>
<li>down</li>
<a href='3_1.html' target='_top'>第一集</a>
<a href='3_2.html' target='_top'>第二集</a>
<a href='3_3.html' target='_top'>第三集</a>
<a href='3_4.html' target='_top'>第四集</a>
<a href='3_5.html' target='_top'>第五集</a>