gpt4 book ai didi

php - 从大内容中抓取文本

转载 作者:行者123 更新时间:2023-12-02 04:55:56 25 4
gpt4 key购买 nike

我需要获取分配给变量 stringquotes 中的文本。这就是内容的样子

Inspired and recalling tricks he learned from Doc and his friends, McQueen quickly emerges to lead the race into the final laps. Hicks, refusing to lose, sends Weathers into a dangerous accident. Seeing this and recalling Doc's fate, McQueen stops just short of the finish line, allowing Hicks to win, and drives back to push Weathers over the finish line. The crowd and media condemn Hicks' victory string="Mickey" and give praise to McQueen's sportsmanship. Though offered the Dinoco sponsorship deal, McQueen declines, insisting on staying with his current sponsors as an appreciation of their past support.

我需要从整个内容中获取 Mickey

我在 PHP 上尝试了 substr,但没有帮助。有什么想法吗?

附言引号内的字符串可能会有所不同。

最佳答案

我觉得preg_match应该这样用;

$matches = Array();
preg_match("/string\=\"(.*?)\"/", $content, $matches);

最后 $matches[1] 应该包含值。

关于php - 从大内容中抓取文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17977437/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com