Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
大家好,我想知道如何使用 Anchor 标签从数据库中获取内容。作为示例,我已在网站上发布了帖子。
Hello I am the PHP.go from here http://php.net
现在,当我从数据库中获取数据时,我想将 php.net 显示为链接。像这样...
你好我是 PHP.go 从这里http://php.net
如何使用 php..
如果有任何教程,与之相关的视频..在这里发布伙计们.. :D
您可以使用regular expression
regular expression
$text = "Hello I am the PHP.go from here http://php.net"; $pattern = "/http:\/\/(www\.)?([^.]+\.[^.\s]+\.?[^.\s]*)/i"; $replace = "<a href='http://\\1\\2'>http://\\1\\2</a>"; $string = preg_replace($pattern,$replace,$text); echo $string;