-1
가 좋아, http://hello.com/api/thispart.php
어떻게이 URL의 특정 부분 출력 preg_match를받을 수 있나요? 나는 URL이있는 경우
는 어떻게는 preg_match() 함수는 단지 thispart
지금까지 내가
preg_match('@^(?:http://)?([^/]+)@', "http://hello.com/api/thispart.php", $matches)
echo " <br>Domain name is: $matches[0] <br>";
echo " <br>Domain name is: $matches[1];
에서 찾고 선택 얻을 수있는 출력은
입니다Domain name is: http://hello.com
Domain name is: hello.com
하지만 난 그냥 출력을 원하는 thispart
이 거의 작동합니다. 나는이 작업을 수행 할 때 그것은 새로운 라인 문자 다음에 thispart을주고, 그래서 비교를 사용할 수 없습니다. – Freiermuth
감사합니다. 매우 도움이되었습니다. 이것은 내가 필요로하는 것을 얻었다! – Freiermuth