Home >Backend Development >PHP Tutorial >PHP outputs a simple dynamic WAP page_PHP tutorial

PHP outputs a simple dynamic WAP page_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:45:571140browse

Of course, there are other methods, which can be found online. I recommend a way to browse both http pages and wap pages, which is to use the Firefox + wmlbrowser component. Firefox with the wmlbrowser component installed can support direct browsing of wap pages.
Due to the need to dynamically output content, we have to set the suffix name of the page to .php. So how do we let the browser parse it into a wap page? It's very simple, just tell the browser the MIME type of the file when the header file is output.

Copy code The code is as follows:

header("Content-type: text/vnd. wap.wml");
?>

With the above sentence, the file extension is not important.
Next, just think of writing a PHP file. The syntax and functions are all as usual. Remember to output the XML format header at the beginning.
Copy the code The code is as follows:

echo ('');
?>

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








Most current WAP phones (Nokia7110, Ericsson R320S, etc.) are all encoded using UTF-8, that is, UNICODE is used for encoding. In this way, if we use Chinese characters (GB2312 encoding) directly in WML, garbled characters will be generated and mobile phone users cannot recognize them. Therefore, before we output Chinese, we must use a program or function to encode the Chinese with UNICODE. In a small number of mobile phones or WAP terminal devices that support GB2312 encoding, we can directly and correctly display Chinese characters after defining the internal code type of the document in the program.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320232.htmlTechArticleOf course, there are other methods, which can be searched online. I recommend a way to browse both http pages and wap pages, which is to use Firefox + wmlbrowser component. Install w...
Statement:
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