向后返回一个文件夹

I have a dynamic URL, for example:

"up/some_images/profile_image_15/200.png"

Is there a command that can give me the path:

"up/some_images/"

?

Yes, use dirname()

$path = "up/some_images/profile_image_15/200.png"
$grandparentdir = dirname(dirname($path)); // "up/some_images"

If you want the trailing / you will have to add it yourself.

Try this dirname — Returns parent directory's path

<?php
print_r(pathinfo(pathinfo("up/some_images/profile_image_15/200.png")["dirname"])["dirname"]);