現在可以上網的手機越來越多, 要是可以隨時在手機上面看到自己的網站的相關信息, 豈不是非常Happy麼。
現在就動手,其實很簡單。
打開/path/to/httpd.conf:在最後添加以下配置內容
代碼:
#Wap MIME
AddType text/vnd.wap.wml .Wml
AddType application/vnd.wap.wmlc .Wmlc
AddType image/vnd.wap.wbmp .Wbmp
AddType application/vnd.wap.wmlscriptc .wmlsc
AddType text/vnd.wap.wmlscript .Wmls
AddType application/vnd.wap/wmlscriptc .Wsc
然後使配置生效。
就這麼簡單,你的Apache已經可以支持Wap訪問了。
來吧:手機打開http://我的網站/index.php,我靠,哪裡支持啊。
對不起對不起,忘記說了,手機wap浏覽器不是網頁浏覽器,恐怕整個手機的容量還沒有網頁浏覽器的軟件那麼大。
用Wap浏覽器就得遵守Wap的語言wml了,下面來個簡單的例子:
在站點根目錄建議wap,在wap裡面建立test.wml,內容如下:
代碼:
<?xml version="1.0" encoding="GB2312"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<!-- Possible <head> element here. -->
<head>
<meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
<meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
</head>
<template>
<!-- Template implementation here. -->
<do type="prev"><prev/></do>
</template>
<card id="card1" title="wap" newcontext="true">
<p>
<b>輸入:</b><br/>
<input name="SID" size="10" maxlength="50" type="text" format="*N" emptyok="true"/><br/>
<br/>
<anchor title="login">
<go href="request.asp" method="post">
<postfield name="code" value="$SID"/>
</go>Implement!<br/>
</anchor>
</p>
</card>
</wml>
來吧:手機打開http://我的網站/wap/test.wml,我靠,真的支持啊。
這裡我就不多講什麼wml語言了,自己去baidu多的是資料啊。
遵循wap的游戲規則,你可以使用php或者cgi來寫你的動態wml頁面了,把服務器的一些信息給處理後送到wml頁面.