开发者

replace specific link to ******* [closed]

开发者 https://www.devze.com 2023-01-27 07:11 出处:网络
开发者_开发知识库 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current for
开发者_开发知识库 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

using php or javascript or ajax how to replace specific link to *

http://www.google.com/. to http://www.****


I'm assuming you mean something like (in Javascript):


var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
 if (links[i].href == "http://www.google.com/") links[i].href = "http://www.blather.blorg/"
}

Tested and works on Firefox 3.


str_replace()

$text = str_replace('google.com', '***', $text);

Even if the question is very different: A short JS solution

text = text.split("google.com").join("***");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号