问题
I've always had problems with strpos, I understand the num v. boolean issue, but I can NOT get this working. The $cur_key value is something like "page=>name"...
$pos = strpos($cur_key, "=>");
if ($pos !== false) {
$mod = explode("=>",$cur_key);
$path = $mod[0];
$param = $mod[1];
}else{
$path = $cur_key;
}
If it's in there it should split it into the two values but no matter what I try it's always just returning the original value...
回答1:
$mod = explode('=>',$cur_key);
$path=$mod[0];
if (sizeof($mod)>1) $param=$mod[1]; else $param='';
来源:https://stackoverflow.com/questions/8702153/php-strpos-not-working