当前位置:Gxlcms > PHP教程 > 效果的对比显示

效果的对比显示

时间:2021-07-01 10:21:17 帮助过:19人阅读

求一个效果的对比显示
-----------------------------------------------------
2120844 DJ小罗Remix这该死的温柔DISCO
2120843 lucky_twice-魔法项链第一首-DJ-舞曲-慢摇
2120842 Beautiful_Girls_(DJ→梦←Extended_Remix)
2120841 DjRuico_FunkyHouse_Remix
----------------------------------------------------
OKNDR1 DjRuico_FunkyHouse_Remix
DGERR2 lucky_twice-魔法项链第一首-DJ-舞曲-慢摇
EGDSF3 DJ小罗Remix这该死的温柔DISCO
EEEED4 Beautiful_Girls_(DJ→梦←Extended_Remix)
--------------------------------------------------

要实现的效果为:
DJ小罗Remix这该死的温柔DISCO [a]2120844[/a] [bb]EGDSF3[/bb]
lucky_twice-魔法项链第一首-DJ-舞曲-慢摇 [a]2120843[/a][bb]DGERR2[/bb]
Beautiful_Girls_(DJ→梦←Extended_Remix) [a]2120842[/a][bb]EEEED4[/bb]
DjRuico_FunkyHouse_Remix [a]2120841[/a][bb]OKNDR1[/bb]

其实就是把,A和B记录对比,拿名称做一个唯一的对比,

我想到思路可不知道用什么代码做好。JS 还是ASP 还是PHP

------解决方案--------------------
PHP code
$a = array(
  array('2120844', 'DJ小罗Remix这该死的温柔DISCO'),
  array('2120843', 'lucky_twice-魔法项链第一首-DJ-舞曲-慢摇'),
  array('2120842', 'Beautiful_Girls_(DJ→梦←Extended_Remix)'),
  array('2120841', 'DjRuico_FunkyHouse_Remix'),
);
$b = array(
  array('OKNDR1', 'DjRuico_FunkyHouse_Remix'),
  array('DGERR2', 'lucky_twice-魔法项链第一首-DJ-舞曲-慢摇'),
  array('EGDSF3', 'DJ小罗Remix这该死的温柔DISCO'),
  array('EEEED4', 'Beautiful_Girls_(DJ→梦←Extended_Remix)'),
);
$r = array();

foreach($a as $v) $r[$v[1]][] = $v[0];
foreach($b as $v) $r[$v[1]][] = $v[0];
foreach($r as $k=>$v)
  echo "$k [a]$v[0][/a] [bb]$v[1][/bb]\n";

------解决方案--------------------
HTML code




test




人气教程排行