日期:2014-05-16  浏览次数:20747 次

在Apache上简简单单开个WAP站点
现在可以上网的手机越来越多, 要是可以随时在手机上面看到自己的网站的相关信息, 岂不是非常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="utf-8"?>; 

<!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页面,不就可以随时手机查看站点情况了么?!!!
转自:http://chinaunix.net/jh/13/314286.html