日期:2014-05-17 浏览次数:20561 次
$str=<<<htm <td>1234567890</td> <td>1234567890123</td> <td>0987654321</td> <td>3210987654321</td> <td>1324354657</td> <td>1324354657689</td> htm; preg_match('/(<td>[\d]{10}<\/td>)/',$str,$match); print_R ($match[1]);
------解决方案--------------------
<?php $str=<<<htm <td>1234567890</td> <td>1234567890123</td> <td>0987654321</td> <td>3210987654321</td> <td>1324354657</td> <td>1324354657689</td> htm; preg_match_all('/(<td>[\d]{10}\b<\/td>)/',$str,$match); print_R ($match[1]);
------解决方案--------------------
preg_match_all('/<td>(\d{10}\b)<\/td>/',$str,$matchs); print_r ($matchs);
------解决方案--------------------
把函数改成 preg_match_all 就行了
preg_match_all('/(<td>[\d]{10}<\/td>)/',$str,$match);