WAP的发展离不开其WWW的底蕴,毕竟,整个WAP协议的制定参照了WWW的模型,并且尽可能地沿用了Internet的诸多标准和技术,如WML语言脱胎于HTML与xml(标准化越来越近了),WMLScript与传统的脚本语言也很相似。的确,WAP虽然是个新名词,但是它却与传统的国际互联网密不可分地结合着,在结构上如此,在技术上更是如此。
在WAP协议中提到WAP页面所使用的标记语言为WML,当需要进行较高级的操作,如使用终端机的某些资源时,可以使用WMLScript脚本语言,这两种语言很简单,甚至可以用简陋来形容,特别是它们对数据库的操作几乎无能为力,这种"缺陷"与WAP广阔的商务和应用前景格格不入,但我们并不是无能为力的,由于WAP和WWW的交融,我们仍然可以使用WWW的技术与资源来解决数据库的访问问题,因为毕竟多数数据库仍处于有线网络内。
目前最流行的网页编程语言和数据库的搭配是什么?相信很多人会说出"php(做为现在的主流开发语言)"与"MySQL(和PHP搭配之最佳组合)"这两个名字。它们属于WWW或者有线互联网的范畴,由于使用方便与功能强大的特点而美名传播,那么它们能够为WAP服务吗?答案是肯定的。不熟悉WAP或者php(做为现在的主流开发语言)的人或许有些不解,毕竟在传统意义上php(做为现在的主流开发语言)提供的是WWW的内容与服务,对于WAP,它们能"兼容"吗?
php(做为现在的主流开发语言)粗解
看了WAP的介绍,大家应该开始逐步理解php(做为现在的主流开发语言)为何仍能为WAP服务了。php(做为现在的主流开发语言)与HTML、WML、Javascript、Java都不一样,它是在服务器端运行的,而Javascript、Java等都运行在浏览器端,相对于WAP,WMLScript运行于客户机端,但是,以上的这些语言都可以很容易与php(做为现在的主流开发语言)结合起来。
php(做为现在的主流开发语言)具有很大的灵活性,在WWW中,它可以生成所需要的任何HTML代码,甚至Javascript代码。同样,在WAP中,我们仍然可以利用php(做为现在的主流开发语言)这种动态、灵活的特点,生成任意的WML代码,这样,php(做为现在的主流开发语言)自然能够为WAP服务。
之所以使用php(做为现在的主流开发语言)来提供WAP服务,除了它灵活的特点外,还由于php(做为现在的主流开发语言)可以方便的使用数据库。用户可以使用php(做为现在的主流开发语言)存取Oracle(大型网站数据库平台)、Sybase、MS SQL、MySQL(和PHP搭配之最佳组合)、dBase、Informix等任何支持ODBC标准的数据库,这点正好迎合了WAP商务的需求。
在实用中,一般需要建立php(做为现在的主流开发语言)文件,当用户向服务器发出浏览该php(做为现在的主流开发语言)文件的请求时,服务器将根据文件中的代码产生相应的HTML或WML内容,并发送给浏览器或WAP终端。
如想获取关于php(做为现在的主流开发语言)的信息,可以前往http://www.php(做为现在的主流开发语言).com查看。
php(做为现在的主流开发语言)-WML
PHP (as the current mainstream development language) ’s system platform, working method, and installation method are not within the scope of this article. After all, our focus is on php (as a Current mainstream development languages)How to collaborate with WAP. Generally speaking, in order to make php(as the current mainstream development language) work, we need a web server with the php(as the current mainstream development language) module, In other words, servers that support php(as the current mainstream development language), apache(the most popular WEB server platform on the Unix platform) is the most popular Web server in the world. In addition, We also need to install php(as the current mainstream development language) software and databases such as MySQL(the best combination with PHP). For specific content, you can refer to relevant books or website. Next we discuss how to make php (as the current mainstream development language) generate WML code.
In the WWW, the first line of content generated by php(as the current mainstream development language) is often: content-type: text/html
However, WAP terminals cannot read such titles. The unit for WAP terminals to download from the server is Deck, and the unit for browsing is Card. Generally, a Deck constitutes a WML file. Then, when serving WAP, the php(as the current mainstream development language) file often needs to contain the following code:
header("Content-type: text/vnd.wap .wml");
echo "<xml(Standardization is getting closer) version="1.01">
"
echo"<! DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN""http://www.wapforum.org//DTD//wml_1.1.xml(standardized Getting closer)">
";
The above three lines of code generate the file header of the WML file (Deck), so that the WAP terminal can identify whether the downloaded Deck is in WML format, and then display the remaining Deck content.
The following is the simplest Deck, which displays "Hello World" on the WAP terminal
<?xml(Standardization is getting closer) version="1.0" encoding=. "ISO-8859-1"?> <! DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org//DTD//wml_1.1.xml(Standardization is getting closer)">