根据车管所的放出车牌好号段生成全部车牌号可筛选不带4
<?php /** * Created by PhpStorm. * User: yang * Date: 2016/7/22 * * B0B0A1 B9C9Z9 */ header("Content-type: text/html; charset=utf-8"); $not4 = $_GET['not4']; $letter = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X','Y','Z'); $letter_size = count($letter); $not_have = array('4'); //不想包含的 $have = array('8','6','B','0','9','C');//必须包含的 $carno_1_begin = '0'; $carno_2_begin = 'B'; $carno_3_begin = '0'; $carno_4_begin = 'A'; $carno_5_begin = '1'; $carno_1_end = '9'; $carno_2_end = 'C'; $carno_3_end = '9'; $carno_4_end = 'Z'; $carno_5_end = '9'; $letter_size_1_begin = array_keys($letter,$carno_1_begin)[0]; $letter_size_2_begin = array_keys($letter,$carno_2_begin)[0]; $letter_size_3_begin = array_keys($letter,$carno_3_begin)[0]; $letter_size_4_begin = array_keys($letter,$carno_4_begin)[0]; $letter_size_5_begin = array_keys($letter,$carno_5_begin)[0]; $letter_size_1_end = array_keys($letter,$carno_1_end)[0]; $letter_size_2_end = array_keys($letter,$carno_2_end)[0]; $letter_size_3_end = array_keys($letter,$carno_3_end)[0]; $letter_size_4_end = array_keys($letter,$carno_4_end)[0]; $letter_size_5_end = array_keys($letter,$carno_5_end)[0]; echo '开始'.$letter[$letter_size_1_begin].$letter[$letter_size_2_begin].$letter[$letter_size_3_begin].$letter[$letter_size_4_begin].$letter[$letter_size_5_begin]."<br/>\r\n"; echo '结束'.$letter[$letter_size_1_end].$letter[$letter_size_2_end].$letter[$letter_size_3_end].$letter[$letter_size_4_end].$letter[$letter_size_5_end]."<br/>\r\n"; //$file = 'log.csv'; //$hp = fopen($file,"a+"); $count = 0; for($i_1=$letter_size_1_begin;$i_1<=$letter_size_1_end;$i_1++){ for($i_2=$letter_size_2_begin;$i_2<=$letter_size_2_end;$i_2++){ for($i_3=$letter_size_3_begin;$i_3<=$letter_size_3_end;$i_3++){ for($i_4=$letter_size_4_begin;$i_4<=$letter_size_4_end;$i_4++){ for($i_5=$letter_size_5_begin;$i_5<=$letter_size_5_end;$i_5++) { // echo $i_1.'^'.$i_2.'^'.$i_3.'^'.$i_4.'^'.$i_5.'='; $car_no[$count] = $letter[$i_1].$letter[$i_2].$letter[$i_3].$letter[$i_4].$letter[$i_5]; if($not4){ if(in_array($letter[$i_1],$not_have)) continue; if(in_array($letter[$i_2],$not_have)) continue; if(in_array($letter[$i_3],$not_have)) continue; if(in_array($letter[$i_4],$not_have)) continue; if(in_array($letter[$i_5],$not_have)) continue; if(!in_array($letter[$i_1],$have)) continue; if(!in_array($letter[$i_2],$have)) continue; if(!in_array($letter[$i_3],$have)) continue; if(!in_array($letter[$i_4],$have)) continue; if(!in_array($letter[$i_5],$have)) continue; } if(false){ $content = $car_no[$count].","; if($count % 26 ==0 ) $content.= "\r\n"; //if($f = file_put_contents($file, $content,FILE_APPEND)){ // echo "。<br />"; //} fwrite($hp,$content); echo '.'; $count++; //if($count>5000) exit; }else{ echo $car_no[$count].","; $count++; if($count % 26 ==0 ) echo "\r\n"; //if($count>10) exit; } } } } } } //fclose($hp); echo $count.'个,写入成功!';