gpt4 book ai didi

php - 更改函数以使用 preg_replace() 而不是 ereg_replace

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:36:39 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
replace ereg_replace with preg_replace

我在代码库中获得了以下函数,该函数采用字符串并使链接处于事件状态。我注意到 ereg_replace() 已折旧。我将如何更改它以使用 preg_replace?

 function makeActiveLink($originalString){

$newString = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\" target=\"_blank\">\\0</a>", $originalString);
return $newString;
}

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