dongpobo6009 2015-10-28 03:25
浏览 40
已采纳

使用php解析html

i want to get only the parse value of the html field here's my html.

 <tr valign="baseline">
   <td nowrap align="left"><label>data:</label></td>
     <td><input type="text" name="data" id="data" size="32" value=""></td>
   </tr>

and here's my jquery inside onclick function.

data =$("#try").html();

  $("#data").val(data);

            console.log("error");

and here's the result that display in the field

<p class="1">1</p><p class="2">2</p><p class="3">3</p>

i want to get only the value of P. its like 123 using php hope anyone can help me as soon as possible. thanks in advance.

  • 写回答

3条回答 默认 最新

  • doulan8330 2015-10-28 03:39
    关注

    your description is a little confusing. But if I got it right you end up with a string like

    <p class="1">1</p><p class="2">2</p><p class="3">3</p>
    

    And you have to filter that string in PHP, not in JS.

    If so, just use strip_tags

    echo strip_tags('<p class="1">1</p><p class="2">2</p><p class="3">3</p>');
    

    Hope that is what you are looking for

    Regards,

    Stefan

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料