PHP 图片处理

1、返回去掉域名

$img_url = "https://xx.xx.xx.xx/upload/image/productImages/1526886370674.JPG";
$pos = strpos(str_replace('://', ':::', $img_url), '/');
$imgUrl = substr($img_url,$pos);    //返回的子字符串将从 start 位置开始直到字符串结尾。 
print_r($imgUrl);
///upload/image/productImages/1526886370674.JPG

2、返回域名

猜你喜欢

转载自blog.csdn.net/eddy23513/article/details/80807027