形成 PHP DOC 关于split
自 PHP 5.3.0 起,该函数已被弃用。强烈建议不要依赖此功能。
尝试
$string = '|../../filesBank/_screenshots/com.beem.project.beem_screenshot_0.jpg|../../filesBank/_screenshots/com.beem.project.beem_screenshot_1.jpg|../../filesBank/_screenshots/com.beem.project.beem_screenshot_2.jpg|../../filesBank/_screenshots/com.beem.project.beem_screenshot_3.jpg|../../filesBank/_screenshots/com.beem.project.beem_screenshot_4.jpg|../../filesBank/_screenshots/com.beem.project.beem_screenshot_5.jpg|../../filesBank/_screenshots/com.beem.project.beem_screenshot_6.jpg|../../filesBank/_screenshots/com.beem.project.beem_screenshot_7.jpg' ;
var_dump(explode("|", $string));
输出
array
0 => string '' (length=0)
1 => string '../../filesBank/_screenshots/com.beem.project.beem_screenshot_0.jpg' (length=67)
2 => string '../../filesBank/_screenshots/com.beem.project.beem_screenshot_1.jpg' (length=67)
3 => string '../../filesBank/_screenshots/com.beem.project.beem_screenshot_2.jpg' (length=67)
4 => string '../../filesBank/_screenshots/com.beem.project.beem_screenshot_3.jpg' (length=67)
5 => string '../../filesBank/_screenshots/com.beem.project.beem_screenshot_4.jpg' (length=67)
6 => string '../../filesBank/_screenshots/com.beem.project.beem_screenshot_5.jpg' (length=67)
7 => string '../../filesBank/_screenshots/com.beem.project.beem_screenshot_6.jpg' (length=67)
8 => string '../../filesBank/_screenshots/com.beem.project.beem_screenshot_7.jpg' (length=67)
* 如果您还想使用split
*
这是你使用它的方式
$string = split("[|]", $string);
var_dump($string);
你可以得到split() [function.split]: REG_EMPTY
因为你试图像这样使用它
$string = split("|", $string);