分割,截取连接字符串

 1 if (!empty($iddstr)) {
 2     if (!empty($iddstr)) {
 3         $darr=explode("\r\n",$iddstr);
 4         foreach ($darr as $key => $value) {
 5             $lp_num = explode("——",$value);
 6             if(strlen($lp_num[0])!=10||strlen($lp_num[1])!=10){
 7                 $tt = $key + 1;
 8                 $this->assign('iddstr',$iddstr);
 9                 $this->error("第".$tt."个联票号段的位数不为10");
10             }
11             if($key == 0){
12                 $where .= " and (left(lianpiaono,10) between '" . $lp_num[0] . "' and '" . $lp_num[1] . "')";
13             }else{
14                 $where .= " or (left(lianpiaono,10) between '" . $lp_num[0] . "' and '" . $lp_num[1] . "')";
15             }
16         }
17      }      
18 }    

 

posted @ 2016-01-21 16:06  北斗星空的笨小孩  阅读(232)  评论(0编辑  收藏  举报