$imgsrc = "http://img1.baidu.com/manhu/目录1/目录2/012.jpg";print_r(preg_split("/[^\/{2,}]\//",$imgsrc));图片地址以/分割,//不分割相要的结果:Array( [0] => http://img1.baidu.com [1] => manhu [2] => 目录1 [3] => 目录2 [4] => 012.jpg)
<?php$imgsrc = "http://img1.baidu.com/manhu/目录1/目录2/012.jpg";var_dump(preg_split('~(?<!/)/(?!/)~', $imgsrc));?>