Title of php during wap development

Source: Internet
Author: User
1. the document structure must first be determined by the title. during web development, html or xhtml is used. wml is used for wap development. what is wml? You can look up more specific materials. I just mentioned it here. in my opinion, w  

1. document structure
First, the title is determined to be a file pattern. during web development, everyone uses html or xhtml, and wml is used for wap development. what is wml? You can look up more specific materials. I just mentioned it here. in my opinion, wml is similar to xml and has a very strict pattern. wml is used for display on wap pages.

The syntax of wml is very simple. when using php for dynamic output, you must send a header to indicate that this page is wml, rather than anything else * ml.


Header ('content-type: text/vnd. wap. wml; charset = \ 'gb2312 \'');
?>


The character set used here is gb2312. there is no title on the mobile platform, but it cannot be used on the platform of China Unicom. UTF-8 must be used for more general purposes, it is safer to use UTF-8. that is


Header ('content-type: text/vnd. wap. wml; charset = \ 'utf-8 \'');
?>


2. encoding

As mentioned above, all character sets should adopt utf-8. this is a character set that can accommodate multiple languages. one Chinese character occupies dual bytes and UTF-8 occupies four bytes. Therefore, it can hold a larger amount of information. after converting the webpage code into UTF-8, a bunch of garbled characters can be opened later. therefore, when you make comments, try to use English comments as much as possible, saving you from understanding them later. tools such as editplus and ultraedit can convert the file internal code.

3. adaptation

Mobile phone manufacturers all over the world are really sick. the mobile phones that are developed are so strange that they can support a wide variety of situations. for example, ringtones, some support, 16, 32, 48 chords, support mid, wmv, and some incomplete support; some support gif, png, bmp, and some incomplete support. although this is to open the mobile phone grade and money, but it is bitter for mobile phone development Brothers. it is inevitable to match the multimedia information such as images and ringtones supported by mobile phones. this matching process is generally called mobile phone adaptation.
To adapt to a mobile phone, we generally need the following materials.

1) a specific mobile phone adaptation Materials Table, which should specifically clarify the ringtones, pictures, and models supported by mobile phones.
2) accurately obtain the UA of the mobile phone. what is UA is actually the user agent.

With the above stuff we can make adaptation. The following is a Class I wrote in wap development, which can be used to get the mobile phone number and the mobile phone UA.

/**
* Class name: mobile
* Description: mobile phone information
* Others: accidental writing
*/
Class mobile
{
/**
* Function name: getPhoneNumber
* Function: retrieve the mobile phone number
* Input parameter: none
* Function return value: the number is returned successfully. if the function fails, false is returned.
* Other clarification: Clarification
*/
Function getPhoneNumber ()
{
If (isset ($ _ SERVER ['http _ X_NETWORK_INFO '])
{
$ Str1 = $ _ SERVER ['http _ X_NETWORK_INFO '];
$ Getstr1 = preg_replace ('/(. *,) (11 [d]) (,. *)/I', '', $ str1 );
Return $ getstr1;
}
Elseif (isset ($ _ SERVER ['http _ X_UP_CALLING_LINE_ID '])
{
$ Getstr2 = $ _ SERVER ['http _ X_UP_CALLING_LINE_ID '];
Return $ getstr2;
}
Elseif (isset ($ _ SERVER ['http _ x_up_subno'])
{
$ Str3 = $ _ SERVER ['http _ x_up_subno'];
$ Getstr3 = preg_replace ('/(. *) (11 [d]) (. *)/I', '', $ str3 );

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.