當前位置:成語大全網 - 書法字典 - Php循環txt文件內容

Php循環txt文件內容

$con = file('1.txt ',FILE _ IGNORE _ NEW _ LINES | FILE _ SKIP _ EMPTY _ LINES);

$ data = array();

foreach($con as $line){

if(stripos $ line,":")= = = false & amp& ampstripos($line,":")=== false){

繼續;

}

$ line = trim($ line);

$ line = preg _ split("/\ s *[::]\ s */ISU ",$ line);

$ data[]= array(" name " = & gt;$line[0]," value " = & gt$ line[1]);

}

var _ dump($ data);