WML,Apache,和 PHP 的介绍
在公司的网站中, 我发现需要一个可以无线接收我的电子邮件,股市资讯等. 不想要付钱给人来得到我要的资讯, 我决定了开发一个无线网站.这样的资讯在网际网路上是没问题的,但是它被分散得难以收集。我需要可以执行 php ,存取资料库,并且我需要 PHP 为我做另外的功能。这篇文章含盖了wml 的基础, 如何建立你的 apache Server 和 php 。这些基础可让你建立环境并且自己学习往後的应用. 我的第一个测试页
需 求
你要对 Apache Web Server, Php 和 html 有点经验. 对系统的要求来说,我是用 apache 1.3.9, php3, 和 Red Hat Linux 6.0 来示范. 我还没碰到在 windows 上跑 Apache, 和 PHP3 或 PHP4 上的任何问题.
在这篇文章,我将指导你接触的领域: wml 的介绍,在 Apache 上设定无线 appications ,并且建立你的第一个 WML/PHP 网页.大部份的资讯可从网际网路上收集.
WML 简 介
WML 代表无线的标注语言. WAP 电话或类似的设备被用来以 WML 写成的网页。WML 基于它类似於 XML 的句法和 scrictness 。使用过了 html 的任何人将不有问题学习 WML 。许多标签和属性是一样的,况且标签不多. WML 允许程式开发者开发动态的内容, 尽管为这篇文章我们将以PHP作为动态的语言.
WML 基 础
在 WML 你能使用许多子页 ( 叫 "cards'' ) 在一个 WML 页中 (叫 " deck") .每个 WML card 的作用像在网页中被显示的内容.下列将是我们 .wml 页的例子 。在我的 Server 上,我在 ~ /wireless/home.wml 储存了这个档案
不同于 HTML ,如果你不colse 标签, 例如
设 定 Apache
好, 现在有趣的部分.为了 apache 能 catch 住无线设备到访你的Server, 你需要建立你的 httpd.conf ( 我的档案位於 /etc/httpd/conf/) 档案, 我用 PHP3 因此所有的变化会被记录。在你开始以前,你可以备份你的 httpd.conf 档案,以防万一:)
步骤 1 :第一, 我们需要 AddType 功能增加一新的 MIME 类型。你需要到你定义 php 的 Script 中。看起来像下面一样:
AddType application/x-httpd-php3 .php3 .php .phtml
AddType application/x-httpd-php3-source .phps
要改为:
AddType application/x-httpd-php3 .php3 .php .phtml .wml
AddType application/x-httpd-php3-source .phps
这会用 PHP compiler 在所有的 .wml 页.
步骤 2 :去除Mark(Uncomment)apache Load Module 和 Add Module
变更:
#LoadModule rewrite_module modules/mod_rewrite.so
#AddModule mod_rewrite.c
成:
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c
步骤 3 : 用 apache mod_rewrite module (只适用 1.2+版以上 ). 用这个,你可以即时的 rewite requested URL(当条件符合时). 需要把这片断码放在网页的底部.
RewriteEngine On
# Catch most WAP browsers
RewriteCond %{HTTP_ACCEPT} text/vnd\.wap\.wml [OR]
# WinWAP, WAPjag
RewriteCond %{HTTP_USER_AGENT} wap [OR]
#Nokia emulators (sdk)
RewriteCond %{HTTP_USER_AGENT} 7110
# Rewrite to where your wireless page is located
RewriteRule ^[\./](.*)$ /home/mydirectory/wireless/home.wml [L]
现在要重新启动 apache server.
产生你第一个无线 WML/PHP 网页
Ok, 既然我们万事俱备, 让我们建立第一个网页。为了能正常运作,你需传送正确的 header 资讯.
# Send the header information
header("Content-type: text/vnd.wap.wml");
?>
# put in the wml code
My first test page
你刚完成了你的第一个“简单”的无线网页。现在, 让我们试著更努力做一些较难的东西吧。
你需要检查你 WAP 兼容的网站设备。我使用 Phone.com 软件开发工具包, 它包含 UP.Simulator , 可以检查我的无线网页。选择不同的电话并且看他们的无线网页通过不同的设备时看起来的长像。
更多的资讯在:
http://updev.phone.com
http://www.wapforum.org
http://www.wap.com
http://www.waplinks.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip
