如何在PHP中获取URL参数?

http://{{base_url}}/post/857161551776694272

I want to get the post_id(which is bold) in the above URL. Parameter does not contain any param name. (Its a PATCH method which also has a json body)

you can get your url segments with parse_url e.g :

$uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri_segments = explode('/', $uri_path);

echo $uri_segments[0];
echo "<br>";
echo $uri_segments[1];