Home > Backend Development > PHP Tutorial > PHP generates dynamic WAP page 2_PHP tutorial

PHP generates dynamic WAP page 2_PHP tutorial

WBOY
Release: 2016-07-13 17:28:24
Original
803 people have browsed it

1. Set up the WEB server
First of all, your Web server must have PHP installed so that it can handle PHP scripts. Secondly, in order for the Web server to recognize and process PHP, WML, WBMP and other files at the same time, the following file types need to be added to the MIME table of the Web server.
text/vnd.wap.wml .wml
image/vnd.wap.wbmp .wbmp
application/vnd.wap.wmlc .wmlc
text/vnd.wap.wmls.wmls
Application/vnd.wap.wmlsc .wmlsc
2. Use PHP to output a simple dynamic WAP page
Here is the simplest example of PHP generating a WAP page. Note that since a PHP interpreter is required to interpret this program and output the WAP page, all similar programs should have a .php extension.
 $#@60;?php
 header(″Content-type: text/vnd.wap.wml″);
 echo (″$#@60;wml$#@62; $#@ 60;card$#@62; $#@60;p$#@62;″);
echo date( ″l dS of F Y h:i:s A″ );
echo (″$# @60;/p$#@62;$#@60;/card$#@62;$#@60;/wml$#@62;″);
 ?$#@62;
That The example can be browsed in the WAP mobile phone simulator and outputs the current date and time, but it cannot be recognized in an ordinary browser and may even be considered an error download. This is because the output document is declared as WML type at the beginning of the program, and this type can only be recognized and interpreted by the WAP device. It is worth noting that our common HTML language does not have strict normative requirements, and most browsers can "tolerate" quite a lot of writing errors, while WML specifications are quite strict, and a single mistake may result in the failure to output the required page.
Once we know the standard process of using PHP scripts to output WAP pages, we can use the powerful functions of PHP with the interactive processing of WML language and the simple scripts of WML Script to develop an application system that suits our needs.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531773.htmlTechArticle1. Set up the WEB server. First, your Web server must have PHP installed, that is, it can handle PHP script programs. Secondly, in order to enable the Web server to recognize and process PHP, WML, WBMP and other files at the same time, Web...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template