Home > Backend Development > PHP Tutorial > php关键字瓜分

php关键字瓜分

WBOY
Release: 2016-06-13 13:22:53
Original
867 people have browsed it

php关键字分割

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
$old_guanjianzi=我,的,php;
标签:<a href="tag.php?so=" foreach as urlencode>><?php echo $v;?></a>

Copy after login


这样分割关键字后只能显示一个关键字。怎么三个关键字用空格分割,每个关键字一个链接。

------解决方案--------------------
PHP code
$old_guanjianzi= "我,的,php";
$ar = explode(',', $old_guanjianzi);
foreach($ar as $v) echo "<a href="tag.php?so=%7B%24v%7D">{$v}</a> ";
<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
探讨

PHP code
$old_guanjianzi= "我,的,php";
$ar = explode(',', $old_guanjianzi);
foreach($ar as $v) echo "{$v} ";

------解决方案--------------------
PHP code
echo "<a href="tag.php?so=%22.urlencode(%24v).%22">{$v}</a> ";?> <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template