Application of PHP Programming in WAP Development _php tutorial

Source: Internet
Author: User
We can use PHP to write WAP programs, such as developing dynamic WML pages, but only if the output labels or statements need to be limited to the acceptable range of WAP mini-browsers. Also, PHP can be written in an HTML (and HDML) file that is suitable for both HTML (and HDML) and WML content. The source code of PHP is not visible to WAP clients, so we can output HTML page for HTML browser and output HDML page or WML page for WAP browser.

11.3.1 Basic Rules

In WML, for example, the basic rules for using PHP to write WML programs are as follows:

(1) Use " " to include a WML program line written in PHP in the following format:

...... (program line);

?>

(2) The program line statements are separated by semicolons (;). At the end, this is a different place than the ASP authoring WML program.

(3) Use 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 you are developing a user who wants to use a normal browser, such as IE, to test the program effect, you can precede the statement with a double slash (//) in the form:

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

In this way, the 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 simulator, just remove the "//" and the current page will automatically become a WML page.

(4) Other WML tags and statement lines are declared using the Echo keyword of PHP, followed by a newline character "" (plus multiple if required) for each WML line. The basic format is:

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

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

Echo (" ");

Also, "WML tags and Statement lines" in the Echo statement can be ligatures to save program code lines. For example, the following line of statements ligatures the WML 3-line label statement:

Echo ("

");

(5) Declare the scripting language. This is the inheritance of PHP programming, declaring to the compiler that the current program uses a script language of PHP, in the following format:

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.