我有这个函数用于显示类型名称:
function is_typename($type){
switch ($type){
case 1:
echo "Bring an extra $500";
break;
case 2:
echo "Bring an open mind";
break;
case 3:
echo "Bring 15 bottles of SPF 50 Sunscreen";
break;
case 4:
echo "Bring lots of money";
break;
case 5:
echo "Bring a swimsuit";
break;
}
}
没有显示链接我有:
echo '<a href="'.SITE.''.$lang.'/'.is_typename($type).'/'.$id.'/'.$seotitle.'" rel="nofollow" title="'.$title.'" target="'.$target.'">'.$title.'</a>';
在行动中我看到:
Bring an extra $500<a href="http://localhost/cms/en//241/titeltest" rel="nofollow" title="titeltest" target="_blank">titeltest</a>
问题:$type
和typename显示在外部href
和<a></a>
中。怎么解决这个问题?
答案 0 :(得分:2)
而不是echo use return,
示例
case 1:
return "Bring an extra $500";
break;