我很难找到特定的对象preg_match_all
图案。我有一条文字。很多数据。但我只想找到一个特定的
就像我有一串文本
sadasdasd:{"website":["https://bitcoin.org/"]tatic/cloud/img/coinmarketcap_grey_1.svg?_=60ffd80');display:inline-block;background-position:center;background-repeat:no-repeat;background-size:contain;width:239px;height:41px;} .cqVqre.cmc-logo--size-large{width:263px;height:45px;}
/* sc-component-id: sc-2wt0ni-0 */
然而我只需要找到"website":["https://bitcoin.org/"]
。其中网站是动态数据。比如网站可以是google"website":["https://google.com/"]
现在我有这样的事情。这只是返回大量网址。我只需要具体的
$pattern = '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#';
preg_match_all($pattern, $parsePage, $matches);
print_r($matches[0]);
我在模式上真的很糟糕并且坚持下去
像这样循环遍历数组:
for ($x = 0; $x <= count(json_decode($array, true)) - 1; $x++) {
if ($array[$x] == "your search criteria") {
echo $array[$x];
break;
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)