php字符串长度判断出问题,希望大神帮忙看下!

下面的代码进行了判断数据库读取的文本字符串字数,但是输出的结果确实有两条,而不是一条,不知道是哪里问题,希望大神帮忙看下!
$str=strlen($r[smalltext]);
if($str>200){
$unfold = "<p id=\"box$r[id]\" style=\"height:78px; overflow:hidden;z-index:99999;\">$r[smalltext]</p><button onclick=\"openShutManager(this,'box$r[id]',false,'收起▲','展开▼')\">展开▼</button>";
}
else{
$close = "<p style=\"height:78px; overflow:hidden;z-index:99999;\">$r[smalltext]</p>";
}
$conditions_a = " ”. $unfold.“ ”. $close.“ “;//这里的代码太长了我就没贴出来
$conditions_b= " ”. $unfold.“ ”. $close.“ “;//这里的代码太长了我就没贴出来
$num=$i++;
if($num%2===0){
echo $conditions_a;
}
else{
echo $conditions_b;
}
输出的时候$unfold和$close有时候会同时输出,不知道是哪里问题!

就你这代码而言,$unfold和$close确实会同时输出啊。

$conditions_a = " ”. $unfold.“ ”. $close.“ “;//这里的代码太长了我就没贴出来
$conditions_b= " ”. $unfold.“ ”. $close.“ “;//这里的代码太长了我就没贴出来

把代码发完整点。
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网