PHP output Simple dynamic WAP page _php tips

Source: Internet
Author: User
Of course, there are other ways to search the Internet can be obtained. I recommend a way to browse both the HTTP page and the WAP page, which is to use the Firefox + wmlbrowser component. Install the Wmlbrowser component Firefox can support the direct browsing WAP page.
Because of the need for dynamic output, we have to set the suffix of the page as. PHP, so how do you let the browser parse it into a WAP page? Quite simply, just tell the browser the MIME type of the file when the header file is output.
Copy Code code as follows:

<?php
Header ("CONTENT-TYPE:TEXT/VND.WAP.WML");
?>

With the above sentence, the file extension is not important.
The next is to write a PHP file on the line, syntax ah function ah all as usual, remember to first output the XML format header,
Copy Code code as follows:

<?php
Echo (' <?xml version= "1.0"?> ');
?>

In addition, the format of the text should be written in WML format (also equivalent to XML), the WML specification is fairly strict, and a bit of error may result in the inability to output the required pages.
A WML template is as follows:
Copy Code code as follows:

<?xml version= "1.0" encoding= "gb2312"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.3//en" "HTTP://WWW.WAPFORUM.ORG/DTD/WML13.DTD" >
<wml>
<card title= "" >
</card>
</wml>

Most of the current WAP phones (Nokia7110, Ericsson r320s, etc.) are encoded using the UTF-8 code, which is encoded using Unicode. In this way, if we use Chinese characters (GB2312 encoding) directly in WML, the code will be garbled and the cell phone user cannot recognize it, so we will use the program or function to encode the Chinese in Unicode before we export the language. In a few mobile phones or WAP terminals that support GB2312 encoding, we can correctly display Chinese characters directly after we have defined the code type of the document in the program.

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.