正则问题 本帖最后由 lazygc520 于 2010-07-29 13:24:44 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 取“** PROGRAM”这行的信息就可以了。 $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); <?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);?> $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 ,你怎么不看看,提供的是string用的时候,传入了数组 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 file 这个函数返回的是数组改成file_get_contents吧,这个直接读文件 PHP文件上传视频不显示 关于php往oracle里存取clob的问题 如何分组查询并现实结果? thinkphp session_start()问题!!! smarty打印一个数组值问题 什么我下的jpg图片都有这样的问题啊?好急~~~ 请问怎么实现网业上的数据动态实时变化啊? 100分求网站计数器的源码!!! 关于coreseek有技术含量的问题 怎么用php同时输出sql的数据并在数据后提供修改删除功能 求一正则表达式 使用netbeans+XDEBUG调试PHP,遇到小问题
** 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);
$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);
?>
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
{
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