PHP outputs simple dynamic WAP page

Source: Internet
Author: User
First, whether you debug locally or want to browse the wap page on the network, you need a browser that can parse the wap page. of course, there are other methods that can be searched online. I recommend that you use the Firefox + wmlbrowser component to view both http and wap pages. After the wmlbrowser component is installed, firefox can directly browse the wap page.
To dynamically output content, we have to set the page suffix as. php. so how can we make the browser resolve it to a wap page? It's easy to tell the browser the MIME type of the file when the header file is output.
The code is as follows:
Header ("Content-type: text/vnd. wap. wml ");
?>

With the above sentence, the file extension is not important.
The next step is to compile a php file. the syntax and functions are all as usual. remember to output the XML format header at the beginning,
The code is as follows:
Echo (' ');
?>

In addition, the text format must be written in the wml format (equivalent to xml). The wml specification is quite strict, and a single mistake may lead to the failure to output the required page.
A wml template is as follows:
The code is as follows:







Currently, most WAP mobile phones (Nokia7110, Ericsson R320S and so on) are encoded using UTF-8, that is, UNICODE. In this way, if we use Chinese characters (GB2312 encoding) in WML, garbled characters will be generated and cannot be identified by mobile users. Therefore, before outputting Chinese characters, UNICODE must be encoded using a program or function. In a few mobile phones or WAP devices that support GB2312 encoding, we can define the document internal code type in the program to directly display Chinese characters correctly.

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.