24
                            07月
                            2015
                        
                        
                            $firstposition=stripos($logistic['content'],";");     //截取分号在字符串中第一次出现的位置
$first=substr($logistic['content'],0,$firstposition+1); 截取分号以前的
$firstarray=explode(",", $first); 以逗号分割
$pagesize="LODOP.SET_PRINT_PAGESIZE(1, $firstarray[2],$firstarray[3], '');";
//var_dump($firstarray);exit;
$firstcnt=$first.$pagesize;
$lastcnt=substr($logistic['content'],$firstposition+1); 截取分号后面的
$content=$firstcnt.$lastcnt; 重组
                            
                                
                        
                        
                    $first=substr($logistic['content'],0,$firstposition+1); 截取分号以前的
$firstarray=explode(",", $first); 以逗号分割
$pagesize="LODOP.SET_PRINT_PAGESIZE(1, $firstarray[2],$firstarray[3], '');";
//var_dump($firstarray);exit;
$firstcnt=$first.$pagesize;
$lastcnt=substr($logistic['content'],$firstposition+1); 截取分号后面的
$content=$firstcnt.$lastcnt; 重组
特殊说明,本文版权归 ning个人博客 所有带原创标签请勿转载,转载请注明出处.
本文标题: php截取在字符串第一次出现的位置和替换