Home > Backend Development > PHP Tutorial > WeChat Public Account Development Tutorial Part 8 - Using Web Page Hyperlinks in Text Messages_PHP Tutorial

WeChat Public Account Development Tutorial Part 8 - Using Web Page Hyperlinks in Text Messages_PHP Tutorial

WBOY
Release: 2016-07-20 11:12:23
Original
1346 people have browsed it

This article mainly introduces the role of web hyperlinks and how to use web hyperlinks in text messages.

The role of web hyperlinks

I think anyone who is familiar with HTML will be familiar with hyperlinks. Today we are going to discuss and use only one type of hyperlink - web page hyperlink, which uses the tag in HTML to link a certain text to other web pages. The example is as follows:

<a href="http://blog.csdn.net/lyq8479">柳峰的博客</a>
Copy after login
Copy after login
The above is a standard HTML code that implements a web page hyperlink, that is, the 5 words "Liu Feng's Blog" are linked to the blog homepage URL. When the 5 words "Liu Feng's Blog" are used, http://blog will be opened. The web page pointed to by .csdn.net/lyq8479.

How to use web hyperlinks in text messages

In fact, almost 100% of developers who don’t know how to use web hyperlinks in text messages are familiar with HTML, especially the tag in HTML. So what’s so special about using hyperlinks in text messages on WeChat public accounts? Why do so many friends have stumbled upon this issue? Let’s first look at two ways to incorrectly use hyperlinks in WeChat:

Incorrect usage 1 (the href attribute value of the a tag is not quoted):

<a href=http://blog.csdn.net/lyq8479>柳峰的博客</a>
Copy after login
Wrong usage 2 (the href attribute value of the a tag is enclosed in single quotes>
<a href=&#39;http://blog.csdn.net/lyq8479&#39;>柳峰的博客</a>
Copy after login

When doing web development, the above two ways of writing are OK, but when placed in the text message of a WeChat public account, both ways of writing are wrong. The web page hyperlink will not work, and it will not work on Android phones. The HTML code will be displayed as is, as shown below:

Effect on Android phone:

The effect on iPhone:

It can be seen that on WeChat, the value of the HTML a tag attribute is not enclosed in quotation marks, or is enclosed in single quotation marks, which is an incorrect way of writing (on the iPhone, it is normal for the value of the a tag attribute href to be enclosed in single quotation marks) . The correct usage is to enclose the value of the href attribute of the a tag in double quotes. The code is as follows:

<a href="http://blog.csdn.net/lyq8479">柳峰的博客</a>
Copy after login
Copy after login

Tip: When testing WeChat public accounts, don’t think it’s completely fine just because the test passes on your own phone, because there are currently several places on WeChat public accounts that behave inconsistently on Android and iOS platforms.

If you think the article is helpful to you, please leave a message or follow the WeChat public account xiaoqrobot to support Liu Feng!


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444569.htmlTechArticleThis article mainly introduces the role of web page hyperlinks and how to use web page hyperlinks in text messages. The role of hyperlinks on web pages. I think those who are familiar with HTML will definitely not know about hyperlinks...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template