这是我的代码
if ($follower_username == $user){
echo $followed_username.",";
};
当它运行时,它会回显echos name,name2,name3,name4
然而,当我这样做时
if ($follower_username == $user){
$names = $followed_username.",";
};
echo $name`;
它只输出name4,
是什么导致它只提取姓氏?
谢谢!
答案 0 :(得分:6)
if ($follower_username == $user) {
$names .= $followed_username;
}
echo $names;
答案 1 :(得分:0)
试试这个:
//outside your loop:
$names = '';
while(){
//...code
if ($follower_username == $user){
$names .= $followed_username.",";
};
echo $names;
}