我想获取一个字符串和另一个字符串之间出现的文本
以下方法似乎不起作用:
preg_match('/'.preg_quote('{').'(.*?)'.preg_quote($rddaddress).'/is', $apiurlTXinfo, $statTXinfogot);
preg_match('/' . strrchr($statTXinfogot[1], '"value":"') . '(.*?)","/',$statTXinfogot[1], $TXinfogot);
$statTXinfogot 返回它应该返回的内容,但$TXinfogot从 $statTXinfogot[1] 的开头返回:","。我希望它从最后一次出现:"值":"开始返回
很抱歉响应缓慢。方法如下:假设我们得到了一个字符串:
$string = "Bubble the octopus in the noble bubble in an ocean.";
echo substr($string, strrpos($string, 'bubble') + strlen('bubble'),
(strrpos($string, '.') - strrpos($string, 'bubble') -strlen('bubble'));
输出:在海洋中