<?php  
$url = "https://cdn.shopify.com/s/files/1/0581/5477/8799/products/618PJr0UkMS._AC_SL1500.jpg?v=1626177615";
$info = $this->getBaseNameByUrl($url);
var_dump(info);
public function getBaseNameByUrl($url) {
        $arr = parse_url($url);
        $arr2 = pathinfo($arr['path']);
        return $arr2;
    }

结果

array(4) { ["dirname"]=> string(34) "/s/files/1/0581/5477/8799/products" ["basename"]=> string(26) "618PJr0UkMS._AC_SL1500.jpg" ["extension"]=> string(3) "jpg" ["filename"]=> string(22) "618PJr0UkMS._AC_SL1500" }

yanping
24 声望0 粉丝

下一篇 »
test