字符串 按特征码截取

agefworld 2013-01-27 03:08:05
<tr>
<th valign="top">文章内容</th>
<td>
<textarea class="required" cols="40" id="topic_body" name="topic[body]" rows="20">
</textarea>
<div class="body_count">
<span id="topic_body_count_notice">你还可以输入10000个字符</span>
</div>
</td>
</tr>
<tr>
<th>标签</th>
<td>
<input id="topic_cached_tag_list" name="topic[cached_tag_list]" type="hidden" />
<div id="tags"></div>
<span class="red">最多添加5个标签,多个标签之间用","(英文逗号)分隔</span>
</td>
</tr>

例如上面字符串 特征码如果是 <tr> </tr> 需要把 每个 <tr> 内容写入数组 并输出 ,变化特征码 为 <th> 时 ,输出数组中为 th 内容
...全文
327 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
agefworld 2013-01-27
  • 打赏
  • 举报
回复
<li>#iconHeader#<div class=\"rtdiv\">\n\t\t<span class=\"visitor\">\u4f18\u4ebf\u7f51\u53cb<\/span>\n\t\t<div class=\"stardiv\">\n\t\t<div style=\"width: 100%\"><\/div>\n\t\t<\/div>\n\t\t<div class=\"datetime\">2013-01-12<\/div>\n\t\t<div class=\"msg\">\u4eb2\uff0c\u517c\u804c\u4e48\uff01\u8981\u6c42\u7535\u8111\u4e0a\u7ebf\u65b9\u4fbf\uff0c\u4f1ayy\u8bed\u97f3\uff0c\u6dd8\u5b9d\u8d2d\u7269\uff0c\u4e00\u5929\u67092\u52304\u5c0f\u65f6\u4e0a\u7f51\u65f6\u95f4\uff0c\u4e00\u592950\u5230200\uff0c\u65e5\u7ed3\uff0c\u6709\u610f\u8005\u52a0\u53e3\u53e3\u3016908142065\u3017\u54a8\u8be2<\/div>\n\t\t<\/div>\n\t\t<\/li><li>#iconHeader#<div class=\"rtdiv\">\n\t\t<span class=\"visitor\">\u4f18\u4ebf\u7f51\u53cb<\/span>\n\t\t<div class=\"stardiv\">\n\t\t<div style=\"width: 100%\"><\/div>\n\t\t<\/div>\n\t\t<div class=\"datetime\">2013-01-04<\/div>\n\t\t<div class=\"msg\">\u3010\u8d44\u6e90\u5171\u4eab\u3011\u2605\u2605\u2605\u3010\u61c2\u5f97\u5165\u3011\u2605\u2605\u2605\u3010\u4e0d\u89e3\u91ca\u3011\n\u4e00\u4e2a\u4e2d\u56fd\u4eba\uff0c\u97e9\u56fd\u68d2\u5b50\u4f60\u4eec\u6709\u4ec0\u4e48\u95ee\u9898\uff0c\u5c31\u95ee\u5427\u3002\n\u3010(\u624b\u52a8\u8f93\u5165\u3010 500yu.\u2103.\u2299.\u039c \u3011,\u522b\u590d\u5236) \u3011\n\u3010(\u624b\u52a8\u8f93\u5165\u3010 500yu.\u2103.\u2299.\u039c \u3011,\u522b\u590d\u5236) \u3011<\/div>\n\t\t<\/div>\n\t\t<\/li> 这样的咋取呀~~~
agefworld 2013-01-27
  • 打赏
  • 举报
回复
追问一下 preg_match_all 哪里有这个详解啊。。。问题基本解决了,谢谢,给分
一起混吧 2013-01-27
  • 打赏
  • 举报
回复
preg_match_all('/<tr>(.+)<\/tr>/isU',$s,$m); print_r($m[1]);
agefworld 2013-01-27
  • 打赏
  • 举报
回复
function ($str,'<tr>','</tr>'){ .... } 输出 数组 ,数组内容 是 tr里面的内容。
agefworld 2013-01-27
  • 打赏
  • 举报
回复
preg_match_all 不会用,貌似需要用这个来解决。。
一起混吧 2013-01-27
  • 打赏
  • 举报
回复
"变化特征码" 是什么意思?

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧