如何使用“|”爆炸字符串[关闭]

I have this string S|http://www.xyz.in, and want to explode this into

Array(0)--> S

Array(1)--> http://www.xyz.in

Please Help I am new to php

You need to escape the escape character.

explode('\\\\',$str); 

If you want to split by the | (like you show in your example), use explode('|',$str)

Try this one:

$str = 'S|http://www.xyz.in';
print_r(explode('|',$str));

OR

$str = "S|http://www.xyz.in";
$chunks = spliti ("\|", $str, 5);
print_r($chunks);

OR

$str = "S|http://www.xyz.in";
$chunks = preg_split("/\|/", $str);
print_r($chunks);