这个功能
function genTags($tags,$sep=',')
{
$tags = preg_replace(array('/ ,/','/, /'),',',$tags);
$tags = preg_replace( "`[,]+`" , ",", $tags);
$tag_array = explode($sep,$tags);
foreach($tag_array as $tag)
{
if(isValidtag($tag))
{
$newTags[] = $tag;
}
}
if(is_array($newTags))
$tagString = implode(',',$newTags);
else
$tagString = 'no-tag';
return $tagString;
}
生成以','标记分隔的标签,以改变标签之间的空格而不是感谢
答案 0 :(得分:1)
将implode
来电中的逗号更改为空格:
$tagString = implode(' ', $newTags);
答案 1 :(得分:0)
更改
$tagString = implode(',',$newTags);
到
$tagString = implode(' ',$newTags);