Home > Backend Development > PHP Tutorial > Do you have any good methods to match URLs in paragraphs and convert them into clickable URLs?

Do you have any good methods to match URLs in paragraphs and convert them into clickable URLs?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-10 09:07:15
Original
1322 people have browsed it

Given a certain piece of text that contains a URL, how to extract the URL and replace it with clickable copy.

Example:

A copywriter:

<code>欢迎来到http://www.baidu.com/aaa/bbb,多谢指教!</code>
Copy after login
Copy after login

Copywriting after conversion:

<code>欢迎来到<a href='http://www.baidu.com/aaa/bbb'>http://www.baidu.com/aaa/bbb</a>,多谢指教!</code>
Copy after login
Copy after login

Do you have any good ideas

Reply content:

Given a certain piece of text that contains a URL, how to extract the URL and replace it with clickable copy.

Example:

A copywriter:

<code>欢迎来到http://www.baidu.com/aaa/bbb,多谢指教!</code>
Copy after login
Copy after login

Copywriting after conversion:

<code>欢迎来到<a href='http://www.baidu.com/aaa/bbb'>http://www.baidu.com/aaa/bbb</a>,多谢指教!</code>
Copy after login
Copy after login

Do you have any good ideas

Regular matching converted

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template