Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 微信公众平台开发文本消息嵌入超链接失败,求助

微信公众平台开发文本消息嵌入超链接失败,求助

Jun 23, 2016 pm 01:57 PM
Embed platform develop Hyperlink

$contentStr = "\n\n回复<a href="http://www.baidu.com/">百度</a>或回复“搜索” 了解详情\n其他文字";                                                                    $resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $msgType, $contentStr);  /*$resultStr = "<xml>							<ToUserName><![CDATA[".$fromUsername."]]></ToUserName> 							<FromUserName><![CDATA[".$toUsername."]]></FromUserName> 							<CreateTime>".time()."</CreateTime>							<MsgType><![CDATA[text]]></MsgType>							<Content><![CDATA[文本\n\n回复<a href="http://www.baidu.com/">需要嵌入超链接的文本</a>或回复“搜索” 了解详情\n其他文字]]></Content>							</xml>";*/                echo $resultStr;           					
Copy after login

希望做过微信公众平台开发的指点下,网上说这么弄可以,但我的一直不成功,求解释


回复讨论(解决方案)

$contentStr = "\n\n回复<a href=\"http://www.baidu.com/\">百度</a>或回复“搜索” 了解详情\n其他文字";
Copy after login
Copy after login
Copy after login
Copy after login

$contentStr = "\n\n回复百度或回复“搜索” 了解详情\n其他文字";
难道这句话,你编辑器没有报错?

改成#1即可

或者
$contentStr = "\n\n回复百度或回复“搜索” 了解详情\n其他文字";

$contentStr = "\n\n回复<a href=\"http://www.baidu.com/\">百度</a>或回复“搜索” 了解详情\n其他文字";
Copy after login
Copy after login
Copy after login
Copy after login

问题解决了!这个“\”有什么用了?

$contentStr = "\n\n回复百度或回复“搜索” 了解详情\n其他文字";
难道这句话,你编辑器没有报错?

改成#1即可

或者
$contentStr = "\n\n回复百度或回复“搜索” 了解详情\n其他文字";

这个用单引号是不行的,在iPhone上可以,但是在安卓手机显示异常。


$contentStr = "\n\n回复<a href=\"http://www.baidu.com/\">百度</a>或回复“搜索” 了解详情\n其他文字";
Copy after login
Copy after login
Copy after login
Copy after login

问题解决了!这个“\”有什么用了?



转义


$contentStr = "\n\n回复百度或回复“搜索” 了解详情\n其他文字";
难道这句话,你编辑器没有报错?

改成#1即可

或者
$contentStr = "\n\n回复百度或回复“搜索” 了解详情\n其他文字";

这个用单引号是不行的,在iPhone上可以,但是在安卓手机显示异常。


是否是同一段代码?



$contentStr = "\n\n回复百度或回复“搜索” 了解详情\n其他文字";
难道这句话,你编辑器没有报错?

改成#1即可

或者
$contentStr = "\n\n回复百度或回复“搜索” 了解详情\n其他文字";

这个用单引号是不行的,在iPhone上可以,但是在安卓手机显示异常。


是否是同一段代码?

是的,文本消息的超链有时在安卓和IOS上不一样


$contentStr = "\n\n回复<a href=\"http://www.baidu.com/\">百度</a>或回复“搜索” 了解详情\n其他文字";
Copy after login
Copy after login
Copy after login
Copy after login

问题解决了!这个“\”有什么用了?
这是转义。。。。
基础知识,建议LZ好好学习一下基础知识。
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Four recommended AI-assisted programming tools Four recommended AI-assisted programming tools Apr 22, 2024 pm 05:34 PM

This AI-assisted programming tool has unearthed a large number of useful AI-assisted programming tools in this stage of rapid AI development. AI-assisted programming tools can improve development efficiency, improve code quality, and reduce bug rates. They are important assistants in the modern software development process. Today Dayao will share with you 4 AI-assisted programming tools (and all support C# language). I hope it will be helpful to everyone. https://github.com/YSGStudyHards/DotNetGuide1.GitHubCopilotGitHubCopilot is an AI coding assistant that helps you write code faster and with less effort, so you can focus more on problem solving and collaboration. Git

Combining PHP with HTML: three techniques for embedding code Combining PHP with HTML: three techniques for embedding code Mar 06, 2024 am 08:09 AM

The combination of PHP and HTML is a common technology in web development. PHP can embed dynamic content in HTML files and implement auxiliary functions, which greatly improves the interactivity and customizability of the website. This article will introduce three techniques for embedding code and provide specific code examples for reference. 1. Use PHP tags to embed code. The most common way is to use PHP tags () to embed PHP code into HTML files to display dynamic content. For example, you can use PHP

What are the empty account detection platforms? Empty number detection tool What are the empty account detection platforms? Empty number detection tool Mar 07, 2024 pm 01:46 PM

With the advancement of communication technology, telephone contact has become more and more common in our daily lives. However, sometimes we may try to call a number only to find that the number is no longer reachable. In order to save time and energy, many people start looking for empty number verification services to confirm the validity of the number. This service can help users quickly check whether a number is valid and avoid unnecessary trouble. 1. What are the empty account detection platforms? Users can check the status of the number, including whether it is empty, by dialing the corresponding inquiry number or visiting the official website through the official inquiry service provided by the operator. This service is provided by many operators to facilitate users to quickly understand the usage of the number. Online empty number detection platforms are now emerging in an endless stream on the market. These platforms provide quick and convenient

What should I do if WPS cannot open a hyperlink? Solution to WPS hyperlink not opening What should I do if WPS cannot open a hyperlink? Solution to WPS hyperlink not opening Mar 13, 2024 pm 08:40 PM

When many of our friends use WPS to edit content, they sometimes add hyperlinks to specific text. Recently, some friends have reported that WPS hyperlinks cannot be opened and cannot be clicked to access after using many methods. About this How to solve the problem? In this software tutorial, the editor will share the specific solutions, hoping to help the majority of users. Solution to WPS hyperlink not opening: Method 1: Move the mouse over the hyperlink to see if it becomes clickable. 1. Open the software, click "File" in the upper left corner of the page, and select "Options" in the menu below. 2. After entering the new interface, click "Edit&rdq" on the left

Learn how to develop mobile applications using Go language Learn how to develop mobile applications using Go language Mar 28, 2024 pm 10:00 PM

Go language development mobile application tutorial As the mobile application market continues to boom, more and more developers are beginning to explore how to use Go language to develop mobile applications. As a simple and efficient programming language, Go language has also shown strong potential in mobile application development. This article will introduce in detail how to use Go language to develop mobile applications, and attach specific code examples to help readers get started quickly and start developing their own mobile applications. 1. Preparation Before starting, we need to prepare the development environment and tools. head

Which AI programmer is the best? Explore the potential of Devin, Tongyi Lingma and SWE-agent Which AI programmer is the best? Explore the potential of Devin, Tongyi Lingma and SWE-agent Apr 07, 2024 am 09:10 AM

On March 3, 2022, less than a month after the birth of the world's first AI programmer Devin, the NLP team of Princeton University developed an open source AI programmer SWE-agent. It leverages the GPT-4 model to automatically resolve issues in GitHub repositories. SWE-agent's performance on the SWE-bench test set is similar to Devin, taking an average of 93 seconds and solving 12.29% of the problems. By interacting with a dedicated terminal, SWE-agent can open and search file contents, use automatic syntax checking, edit specific lines, and write and execute tests. (Note: The above content is a slight adjustment of the original content, but the key information in the original text is retained and does not exceed the specified word limit.) SWE-A

Where can I buy Optimism coins? Which platform is Optimism Coin traded on? Where can I buy Optimism coins? Which platform is Optimism Coin traded on? Feb 28, 2024 pm 04:40 PM

Where can I buy Optimism coins? Optimism Coin can be purchased on a number of cryptocurrency exchanges, including: Binance Huobi OKX Matcha Gate.io Kraken Bittrex Poloniex Coinbase Pro Gemini You will need to register an account with these exchanges and complete identity verification before you can purchase Optimism Coin. The steps to purchase Optimism coins are as follows: Choose a safe and reliable exchange. Register an account and complete identity verification. Fund your account. On the trading interface of the trading platform, find the trading pair of Optimism currency, such as OP/USDT. Enter the amount of Optimism coins you want to purchase and click

Tutorial on how to insert hyperlinks into PPT slides to achieve skipping playback Tutorial on how to insert hyperlinks into PPT slides to achieve skipping playback Mar 26, 2024 pm 02:51 PM

1. Open a PPT, or make a PPT that requires hyperlinks. 2. Select the content that needs to be inserted into a hyperlink. For example, we select the word &quot;flower&quot; and insert a hyperlink into it. 3. Click Insert in the menu bar, find the Hyperlink in the Link column, and click the hyperlink. 4. A window will appear, with the link on the left to select the location in this document, and then each slide in the PPT will appear. 5. You can select the slide you want to link, click once, and the preview mode of this slide will appear on the right. 6. With the hyperlink, the font color will change. We only need to click on the hyperlinked word when playing the slide, and the slide will automatically play to the slide we linked to.

See all articles