本帖最后由 lazygc520 于 2010-07-29 13:24:44 编辑

解决方案 »

  1.   

    取“** PROGRAM”这行的信息就可以了。
      

  2.   

    $str=' ** PROGRAM : O534W8D2  REV. N.22     DEVICE TYPE : V58B DDR3 
     ** PROGRAM : 2112W8D2  REV. N.12     DEVICE TYPE : V58B DDR3 
    ';preg_match_all('/PROGRAM\s*\:\s*([\w]+)\s*REV\.\s*([\w|\.]+)\s/is', $str, $match);
    print_r($match);
      

  3.   

    <?php
    $subject='=DUT     32   STN      2    TEST START : 10/07/15 15:25:48 ** PROGRAM : O534W8D2  REV. N.22     DEVICE TYPE : V58B DDR3 ';preg_match_all('/\*\* PROGRAM.*$/is', $subject, $matches);
    print_r($matches);
    ?>
      

  4.   

     $myfile = file($TestDataPath.$file);
     preg_match_all('/PROGRAM\s*\:\s*([\w]+)\s*REV\.\s*([\w|\.]+)\s/is', $myfile, $match);
     print_r($match);报错:
    Warning: preg_match_all() expects parameter 2 to be string, array given 
      

  5.   

    ,你怎么不看看,提供的是string用的时候,传入了数组
      

  6.   

    while($file=$mydir->read())

    if(!(is_dir($TestDataPath.'/'.$file)) AND ereg("TestItems",$file) AND ereg("\.asc+$" ,$file))
    {
     $myfile = file($TestDataPath.$file);
     preg_match_all('/PROGRAM\s*\:\s*([\w]+)\s*REV\.\s*([\w|\.]+)\s/is', $myfile, $match);
     print_r($match);
    }
    }Warning: preg_match_all() expects parameter 2 to be string
      

  7.   

    file  这个函数返回的是数组改成file_get_contents吧,这个直接读文件