更新时间:2023-02-26 11:03:29
如果知道要替换的确切字符串,可以使用str_replace
if you know the exact string you want to replace you can use str_replace
$string = '<p>This is my super dupa text and it has my phone number: 083 23212212 32</p>';
$string = str_replace("phone number:", "<b>phone number:</b>", $string);
字符串现在具有粗体字'phone number:'。如果你有一些东西要替换你可以使用str_replace数组。请查看php网站上的示例: http://php.net/manual /en/function.str-replace.php
String now has 'phone number:' in bold. If you have a number of things to replace you can use str_replace with arrays. look at the examples on the php website here: http://php.net/manual/en/function.str-replace.php