php wap开发环境配置
1 2 3 4 5 6 7 8
| 配置 apache里http.conf文件的 AddType部分加入以下部分。 AddType text/vnd.wap.wml .wml AddType application/vnd.wap.wmlc .wmlc AddType text/vnd.wap.wmls .wmls AddType application/vnd.wap.wmlsc .wmlsc AddType image/vnd.wap.wbmp .wbmp AddType image/vnd.wap.wbmp .wbmp 重启Apache,这就OK了;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| 下面是测试代码:
两边一定要有空格 要不然会提示下载,我就被他折磨了很久;
<?php header("Content - type: text/vnd.wap.wml"); echo "<?xml version="2.0"?>"; echo "<!DOCTYPE wml PUBLIC "- "http://www.wapforum.org//DTD//wml_1.1.xml">"; echo "<!--Nokia Parser Info: Phone = Nokia 7110; Height = 90; Width = 130; CurrentDeckSize = 38; MaxDeckSize = 1600; CardsOnEachLine = 5; CardsVerticalGap = 30-->"; echo "<wm>"; echo "<card id="card1" ordered="true" newcontext="false">"; echo "<p align="left">"; echo "Hello World"; echo "</p></card></wml>"; ?>
也可以这样
header("Content - type: text/vnd.wap.wml"); echo <<<EOD <?xml version="2.0"?> <!DOCTYPE wml PUBLIC "- "http://www.wapforum.org//DTD//wml_1.1.xml"> <!--Nokia Parser Info: Phone = Nokia 7110; Height = 90; Width = 130; CurrentDeckSize = 38; MaxDeckSize = 1600; CardsOnEachLine = 5; CardsVerticalGap = 30--> <wm> <card id="card1" ordered="true" newcontext="false"> <p align="left"> Hello World </p></card></wml> EOD;
|
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
微信支付
支付宝