PHP strpos not working

≡放荡痞女 提交于 2019-12-11 01:44:35

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!