WeChat Public Account Development tutorial 7th-using the line break in text messages _php Tutorial

Source: Internet
Author: User
This article focuses on the benefits of using line breaks in text messages and how to use line breaks.

The last one months, although not time to write a blog, but has been seriously answering the questions raised. Received so many responses, attention and appreciation, or quite a sense of accomplishment, let me feel that doing this matter more and more meaningful, more determined I continue to write down the determination. After the first six articles, I believe that you have mastered the basic development knowledge of public accounts (based on Java), such as frame building, API encapsulation, message receiving and reply, etc. the next series will focus on the development of skills and practical functions in public account development (such as weather inquiries, perimeter searches , man-machine dialogue, etc.).

Benefits and examples of using line wrapping

The benefit of using line wrapping is to make the information appear more neat, beautiful and intuitive, appropriate in the text message to use the line break, it will make people feel comfortable, clear and clear after the look. The following is an example of the main menu of the public account Xiaoqrobot, that is, the use of a line break, it seems to be very intuitive, refreshing it? What Think it's ugly? Well, that's even my narcissism ... )

You can imagine if this text menu doesn't use a newline character, what will it look like?

How do I use a line break in a text message?

In the text message of the public account, the line break is still "\ n" and the following code explains how the Xiaoqrobot text menu is implemented.

/** * Xiaoqrobot Main Menu *  * @return */public static String Getmainmenu () {StringBuffer buffer = new StringBuffer (); buffer . Append ("Hello, I am a small q, please reply to the number selection service:"). Append ("\ n"); Buffer.append ("1  Weather Forecast"). Append ("\ n"); Buffer.append ("2  Bus Query "). Append (" \ n "); Buffer.append (" 3  Peripheral Search "). Append (" \ n "); Buffer.append (" 4  song on Demand "). Append (" \ n "); Buffer.append ("5  Classic Game"). Append ("\ n"), Buffer.append ("6  Beauty Station"). Append ("\ n"); Buffer.append ("7  Face Recognition"). Append ("\ n"); Buffer.append ("8  chat chit chat when"). Append ("\ n"); Buffer.append ("Reply"? " Show this Help menu "); return buffer.tostring ();}

What, is it easy to implement?

1) 9-16 lines is the menu item, and each menu item is separated by a line break;

2) The 8th line, the end of the 16th are used two line breaks, so that the menu items and other content can be separated, more layered sense, it will look comfortable, intuitive point.

May be careful friends have found: on, "around the search" and "beautiful radio" behind there is a "gift" expression, and the code did not see, this is I specifically removed, because I intend to use an article in the back of the QQ expression to send, processing, reception to speak clearly.

Details determine success or failure!

http://www.bkjia.com/PHPjc/444570.html www.bkjia.com true http://www.bkjia.com/PHPjc/444570.html techarticle This article focuses on the benefits of using line breaks in text messages and how to use line breaks. The last one months, although not the time to write a blog, but has been seriously reply to everyone put forward ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.