<?php
$test = ' /clothing/men/tees';
$req_url = explode('/', $test);
$c = count($req_url);
$ex_url = 'http://www.test.com/';
for($i=1; $c > $i; $i++){
echo '/'.'<a href="'.$ex_url.'/'.$req_url[$i].'">
<span>'.ucfirst($req_url[$i]).'</span>
</a>';
//echo '<br/>'.$ex_url;....//last line
}
?>
输出 - 1 //当评论最后一行如何在PHP中连续连接字符串?
/ Clothing/Men/Tees
输出 - 2 //当取消注释最后一行$ ex_url显示
/ Clothing
http://www.test.com// Men
http://www.test.com// Tees
http://www.test.com/
1.所需的输出 -
跨度 - /服装/男装/ T恤和最后一个元素不应该点击
和链路应该以这种方式
http://www.test.com/clothing/Men/tees -- when click on Tees
http://www.test.com/clothing/Men -- when click on Men
创建...分别
2.输出2为什么谈到这样
输出1不起作用? – 2014-12-02 08:22:04
从0开始的数组不是1 1 – Naruto 2014-12-02 08:22:16
@Naruto字符串以斜杠开始以及... – RichardBernards 2014-12-02 08:24:50