解决方案 »

  1.   

    $a =<<< TXT
    <table border="0" align="center" cellpadding="0" cellspacing="6" class="cetTable">
        <tr>
            <th>姓名:</th>
            <td>赵阳</td>
        </tr>
        <tr>
            <th>学校:</th>
            <td>长春中医药大学</td>
        </tr>
        <tr>
            <th>考试类别:</th>
            <td>英语四级</td>
        </tr>
        <tr>
            <th>准考证号:</th>
            <td>220090132112529</td>
        </tr>
        <tr>
            <th>考试时间:</th>
            <td>2013年12月</td>
        </tr>
        <tr>
            <th valign="top">总分:</th>
            <td valign="top" class="fontBold">
            <span class="colorRed">
             
                0
             
            </span>
             
                <br /><span class="color666">听力:</span>
                 
                    000
                 
                <br /><span class="color666">阅读:</span>
                 
                000
                 
                 
                <br /><span class="color666">写作与翻译:</span>
                 
                000
                 
            </td>
        </tr>
    </table>
    TXT;
    $match="#<t[hd].*?>(.*?)</t[hd]>#is";
    preg_match_all($match,$a,$b);
    $b[1][11] = preg_replace('/\s/', '', strip_tags($b[1][11]));
    print_r($b[1]);Array
    (
        [0] => 姓名:
        [1] => 赵阳
        [2] => 学校:
        [3] => 长春中医药大学
        [4] => 考试类别:
        [5] => 英语四级
        [6] => 准考证号:
        [7] => 220090132112529
        [8] => 考试时间:
        [9] => 2013年12月
        [10] => 总分:
        [11] => 0听力:000阅读:000写作与翻译:000
    )
      

  2.   

    现在有个问题最后一行?>报错
    我把你这个
    $match="#<t[hd].*?\>(.*?)</t[hd]>#is";
    转义了还是报错