내 웹 사이트에 이런 모양의 URL이 있습니다.매번 URL의 마지막 부분을 파기하십시오.
http://example.com/our-post-name-here-number-one-81347.html our post name number one
http://example.com/our-post-name-here-number-two-81348.html our post name number two
http://example.com/our-post-name-here-number-three-81349.html our post name number three
그리고이 숫자는 지금까지 동일합니다없는 입장에서, 임의의 숫자를 포함 .html
을 befor 부품 권리를 얻을 필요가 있어요.
현재이 URL을 .txt
파일에 저장하고 있으며이 파일에는 게시물 제목도 포함되어 있으며 아래에서이 방법으로 폭발합니다.
$array = explode("\n", file_get_contents('http://example.com/urls/delete.txt'));
foreach ($array as $item) {
$removed = "copyright";
$nothing = "";
$url = explode(" ", $item);
$data = $url[0];
$explode = explode(".html", $data);
// other functions
$primary = $explode[0];
print $primary;
print '<br>';
}
위의 코드는 현재이를 반환하고 있습니다.
http://example.com/our-post-name-here-number-one-81347
http://example.com/our-post-name-here-number-two-81348
http://example.com/our-post-name-here-number-three-81349
나는 만이
81347
81348
81349
을 반환 할 때. 같은 형식이 보장되면