php教程 正則指定區別內容
*/
$str ="{dede:link text='三版下載'} http://softs.111cn.net/5j/game/2011/03/04/hs60v3.sisx {/dede:link}
";
$link = array_filter(explode('{/dede:link}',$str ),"filter");
$len = count( $link );for( $i=0;$i< $len-1;$i++ )
{
$tpattern="/{dede:link text='(.*)'}/i";
$ppattern="/'}(.*)/i";
preg_match_all($tpattern,$link[$i],$title);
preg_match_all($ppattern,$link[$i],$path);
echo '<a href='.$path[1][0].' >'.$title[1][0].'</a> ';
}function filter($var)
{
if($var == '' || $var ==' ')
{
return false;
}
return true;
}