내가예쁜 URL을
function url($string) {
//lower case everything
$string = strtolower($string);
//make alphaunermic
$string = trim($string);
//Clean multiple dashes or whitespaces
$string = preg_replace("/[\s-]+/", " ", $string);
//Convert whitespaces and underscore to dash
$string = preg_replace("/[\s_]/", "-", $string);
return $string;
}
//some artist now becomes some-artist, some song now becomes some-song
를 대시 내 변수의 모든 공간을 변경하는 몇 가지 코드를 가지고 그리고 난 규칙을
같은RewriteRule ^mp3/(.*)-(.*)/?.html$ mp3.php?artist=$1&song=$2 [nc]
그래서 내가 할 수 URL이
www.example.com/mp3/some-artist-some-song.html
하지만 아티스트가 노래와 분리되는 부분이 섞여 있습니다. 그 페이지에서 아티스트를 반향 시키면 "some-artist- 일부 "실제 아티스트 변수가"일부 아티스트 "일 때 첫 번째 변수가 마지막 대시 이전의 모든 것이 아니라고 생각하는 것 같습니다. 어떻게 해결할 수 있습니까?
어떻게 인간을 * 수정 했습니까?! 아티스트는 "some"이고 노래는 "artist-some-song"입니까? 아니면 아티스트 "some-artist-some"과 노래 "song"입니까? 명명 체계가 모호하다면 할 수있는 일은 거의 없습니다. – deceze
나는 www.example.com/mp3/some-artist/some-song.mp3을 더 잘 사용한다. – Voitcus
나는 mutiple 변수를 가진 모든 대쉬를 가지고있는 다른 사이트를 보았으므로 그것을 할 방법이 있어야한다. – Bren