脚本,用于在找到预定义文本时添加超链接


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

我使用PHP从谷歌日历XML提要中提取一些数据,我想知道是否有任何类型的脚本将在此之后运行,如果它找到某个短语(不是URL),添加一个超链接到它?

。如果它从提要中提取"Bayerische Staatsoper",它将添加一个Staatsoper网站的超链接。

这可能吗?

希望这有意义。

谢谢

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

以上代码在变量$text中搜索"Bayerische Staatsoper",并将其替换为链接。