提取标签的最佳方法是什么?

时间:2017-11-26 00:49:40

标签: php

我有这些元素,我需要提取此{{search_tag}}并替换为值

https://www.toto.com/search/10/{{search_tag}}.html#_his_

我尝试了这个,但我不知道如果它是好方法,那就不起作用。

$words = explode('{{search_tag}} ',$website_url[$n]);
$exists_at = array_search($seach,$words);
if ($exists_at){
  echo "Found at ".$exists_at." key in the \$word array";
}

1 个答案:

答案 0 :(得分:0)

您可以使用str_replace

find