<?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