<?php $str = "abc:def:hij"; $arr = explode(':',$str); echo '<pre>'; echo '成功<br>'; var_dump($arr); echo '</pre>'; $str = "abcdefhij"; $arr = explode(':',$str); echo '<pre>'; echo 'no成功<br>'; var_dump($arr); echo '</pre>';
浏览器输出结果:
成功 array(3) { [0]=> string(3) "abc" [1]=> string(3) "def" [2]=> string(3) "hij" } no成功 array(1) { [0]=> string(9) "abcdefhij" }