开发者

Script to add hyperlink when pre-defined text is found?

开发者 https://www.devze.com 2023-04-09 04:49 出处:网络
开发者_开发技巧I\'m using PHP to pull some data from an google calendar XML feed, and I\'m wondering if there\'s any kind of script that will run after this and if it finds a certain phrase (not a URL

开发者_开发技巧I'm using PHP to pull some data from an google calendar XML feed, and I'm wondering if there's any kind of script that will run after this and if it finds a certain phrase (not a URL), add a hyperlink to it?

E.g. if it pulls "Bayerische Staatsoper" from the feed it will add a hyperlink for the Staatsoper website.

Is this possible?

Hope that makes sense.

Thanks


str_replace("Bayerische Staatsoper","<a href='#'>Bayerische Staatsoper</a>",$text);

The above code searches for "Bayerische Staatsoper" in variable $text and replaces it with the link.

0

精彩评论

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