Development of WAP Web site PHP program writing considerations

Source: Internet
Author: User
Keywords Web Programming PHP Tutorials
Tags .mall basic browser development echo example multiple php

Two years ago I have contacted the production of WAP website, today 3g came out now let's take a look at some small details about using PHP to write WAP sites.

(1) Use " and "?>" to contain the WML program line written by PHP, in the form:

?

...... (program line);

?>

(2) All other WML tags and statement lines are declared using the Echo keyword of PHP, followed by the newline character "n" (plus multiple, as needed) after each WML line. The basic format is:

Echo ("...) (WML label and statement line) n ");

For example, the following statement is a typical example of PHP writing a WML statement line:

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

Furthermore, the "WML label and statement line" in the Echo statement can be ligatures to save the line of code for the program. For example, the following line of statements ligatures 3 row of WML label statements:

Echo ("<wml> <card> <p>");

3 The file is last saved with the extension ". php" or ". PhP3", not ". WML" extensions.

4 The line statements are separated by semicolons (;). At the end, this is a different place to write WML programs with ASP.

5 Declare the scripting language. This is the inheritance of PHP programming, to the compiler to declare the current program using the scripting language for PHP, in the form of:

<script language= "PHP" >

However, this sentence can be omitted, because the compiler can automatically identify PHP script program.

6 using the Header keyword of PHP to declare the file type of WML, the basic format is:

Header ("CONTENT-TYPE:TEXT/VND.WAP.WML");

The above format is a written format specifically designed for WAP browser recognition. If the development user wants to use a normal browser, such as IE to test the effect of the program, you can precede the statement with a double slash (//), formatted as:

Header ("CONTENT-TYPE:TEXT/VND.WAP.WML");

This way, a pc-based browser ignores WML tags that are not understood in the program, and the current program actually becomes an HTML page. When you want to test on a WAP device or emulator, just remove "//" and the current page will automatically become a WML page.

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.