これは私のコードです:私のページでパスの一部を置換/抽出するにはどうすればよいですか?
<?php
$path = "monkey/cat/horse";
$linkPath = str_replace("/", "</a><br><a href='my page.html/".$path."'>", $path);
echo "<a href='my page.html/".$path."'>".$linkPath . "</a>";
?>
それは、この出力:
<a href='my page.html/monkey/cat/horse'>monkey</a><br>
<a href='my page.html/monkey/cat/horse'>cat</a><br>
<a href='my page.html/monkey/cat/horse'>horse</a>
今私の問題は次の場合には、リンク値のパスのみになりたいということです。これは私の望ましい結果ではなく、
<a href='my page.html/monkey'>monkey</a><br>
<a href='my page.html/monkey/cat'>cat</a><br>
<a href='my page.html/monkey/cat/horse'>horse</a>
編集あなたの質問コードルックSANE( '$のPATH')を作り、私は'これは私のcode'あるとの出力を生成コードをマーク 'マイresult' –
@MarcinOrlowskiを生成し、あなたの現在のコードを追加すると、あなたは「sane」とは何を意味しますか? – Jarla
あなたは1つの文字列または3つのリンクから3つのリンクが必要ですか? –