【发布时间】:2013-11-22 20:20:27
【问题描述】:
我有一个字符串,我需要将任何 url 替换为 <a> html 标记
$str='Lorem Ipsum is simply dummy text of http://www.lipsum.com/ the printing';
$outputString=
'Lorem Ipsum is simply dummy text of <a href="http://www.lipsum.com">http://www.lipsum.com/</a> the printing';
【问题讨论】:
-
$ouputString无效,双引号需要转义 -
这只是一个示例,不完全是真正的代码,我只需要答案提示
-
@AlexP 如果字符串被单引号包围,则不是...就像在 OP 中一样
-
这个问题之前在 SO 上已经被问过很多次了。试着先四处寻找。 stackoverflow.com/questions/1188129/… 和 stackoverflow.com/questions/1959062/… 和 stackoverflow.com/questions/1960461/… 只是几个例子。
-
-1 并投票赞成关闭 这是重复的,您甚至都没有费心证明您自己已经做出任何努力。