Maison >développement back-end >tutoriel php >请问一下,怎么把用"|"格开的字符串,猜开?
$aaaa = "image/1.jpg|image/2.jpg|image/3.jpg"
请问一下,怎么把用"|"格开的字符串,猜开?
猜成下面的字符串.
$a1 = "image/1.jpg";
$a2 = "image/2.jpg";
$a3 = "image/3.jpg";
请详细一些,谢谢.
list($a1, $a2, $a3) = explode('|', $aaaa);
explode
list($a1, $a2, $a3) = explode('|', $aaaa);
正解
http://www.w3school.com.cn/php/func_string_explode.asp
了解一下这个explode函数
$aaaa = "image/1.jpg|image/2.jpg|image/3.jpg"; $ar=explode("|",$aaaa); echo "<pre class="brush:php;toolbar:false">"; print_r($ar); echo "";