数据库表是
id keywords
1 你好,很好,都好
1 都很好
1 很好,行
$str = $row['keywords'];
打印后是:
string(20) 你好,很好,都好
string(26) 都很好
string(34) 很好,行
我想输入来的一些词,把他们分开加上链接。
以下代码是 phpwind框架,直接循环输出了。
$dosql->execute(select * from #@__infolist` where (classid=1 ) order by id asc limit 0,100);
{ while ($row = $dosql->getarray()) echo $str = $row['keywords']; //这里 输出是 你好,很好,都好,都很好,很好,行 $str_keywords= array_filter(explode(,,$str)); //目的是为了把逗号替换掉}foreach($str_keywords as $v){ echo ''.$v.''; //结果这里只输出 很好 行 }`
为什么不全部输出呢? 只有很好 行
是用phpmywind框架。
回复内容: ====================================
数据库表是
id keywords
1 你好,很好,都好
1 都很好
1 很好,行
$str = $row['keywords'];
打印后是:
string(20) 你好,很好,都好
string(26) 都很好
string(34) 很好,行
我想输入来的一些词,把他们分开加上链接。
以下代码是 phpwind框架,直接循环输出了。
$dosql->execute(select * from #@__infolist` where (classid=1 ) order by id asc limit 0,100);
{ while ($row = $dosql->getarray()) echo $str = $row['keywords']; //这里 输出是 你好,很好,都好,都很好,很好,行 $str_keywords= array_filter(explode(,,$str)); //目的是为了把逗号替换掉}foreach($str_keywords as $v){ echo ''.$v.''; //结果这里只输出 很好 行 }`
为什么不全部输出呢? 只有很好 行
是用phpmywind框架。
$str_keywords 覆盖了之前的 $str_keywords值。。。修改为 $str_keywords= array_merge($str_keywords, array_filter(explode(,,$str)));
你把keywords 先组装成你想要的 字符串样式 在输出