好的,如果我有网址http://hello.com/api/thispart.php
如何让 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