dpsq8476 2010-02-19 15:53
浏览 23
已采纳

在PHP中,如何在两个字符串之间创建所有字符串的数组?

I have a chunk of text like:

<b>First content</b> followed by <b>second content</b>

OR

"First content" and then "second content"

And I want to create an array that looks: [1] => "First content" [2] => "second content"

From either example, where I get the content between two tags. I've figured out how to get the first instances, but can't figure out the best way to make it recursive.

  • 写回答

5条回答 默认 最新

  • douluan5523 2010-02-19 15:56
    关注

    If you know what exactly is between "First content" and "second content", use explode:

    http://php.net/manual/en/function.explode.php

    e.g.

    $values = explode("followed by", $yourtext);
    

    (use "strip_tags" on your array-elements if you just want the plaintext)

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

报告相同问题?

悬赏问题

  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)