Home php教程 php手册 建立动态的WML站点(一)

建立动态的WML站点(一)

Jun 13, 2016 pm 12:40 PM
wap one one time Function dynamic Establish support of site consider

支持WAP功能的移动电话越来越多了。因此,你也应该考虑一下建立自己的WML网站了,本文要介绍的是如何建立PHP/WML页面的站点,使用MySQL数据库,可动态更新站点的内容,具体例子是某个学院的教授授课时间和测验时间表。一点也不复杂哦 :-)  
  在开始之前,你应该准备好以下东东:

  1.你已经正确安装好PHP和MySQL,并且有使用两者编程的经验。
  2.你有SQL的相关知识
  3.你运行的是Apache并且可写.haccess文件;或者你运行IIS并且你可以增加映射(或者你可以让系统管理员帮你的忙);
  4.你有WML的相关知识;

  好了,第一步首先让你的服务器知道使用PHP来处理WML文件,以下介绍如何做到这一点。

设置服务器

   如果你使用的是Apache,你必须在你的目录中找到一个.htaccess文件。然后,加入以下行:

    AddType application/x-httpd-php3 .wml

  如果你找不到该文件,可以加入一个,并且加入以上行,放在你的目录中。

  如果你使用的是IIS,你必须做一些改动,与安装PHP时差不多:看一下.php和.php3扩展名的映射,并且为.wml加入同样的映射处理。

  通常你会发现PHP被映射到:

   C:\php\php4isapi.dll

  或者

   C:\php\php.exe

准备工作

  如果你使用的是微软的操作系统,你可以安装NOKIA的开发工具包。它可以检查你的语法,并且让你通过一个类似电话的界面来预览WML页面,该工具包还带有关于WML和WML脚本的参考文档。如果你的电话没有WAP支持,或者你不能使用一个WAP网关,这可以帮上大忙哦。

  要下载这个工具,你首先必须以一个WAP开发者的身份在这个网站登记(http://www.forum.nokia.com/main/0,6668,1_1_4,00.html),要记住的是你需要Java2 Runtime Enviroment的支持(Java2运行环境的支持)。你可以使用任何的文本编辑器来写页面。

  在写任何PHP/WML代码前,你需要建好MySQL的表格。

  该数据库由4个表够成。

  1.professors表包括教授的相关数据;
  2.subjucts表包括主题的相关数据;
  3.exams表包括测验的相关数据;
  4.teach表包括教授和他们所授科目的关系信息

  在连接MySQL时,可通过以下的代码建立表格

CREATE TABLE professors (
Id int(11) DEFAULT '0' NOT NULL auto_increment,
Surname varchar(24) NOT NULL,
Name varchar(24) NOT NULL,
Email varchar(48) DEFAULT 'Not avaliable',
Cod_course varchar(16) DEFAULT 'Not avaliable',
Consulting_hour varchar(128) DEFAULT 'Not avaliable',  
Consulting_place varchar(128) DEFAULT 'Not avaliable',
PRIMARY KEY (Id)
);  

  这些语句建立了professors的表结构。ID为每个教授分配了一个唯一的识别号,而且是表的主键。其它字段,Surname, Name, Email用来表示每个教授的姓、名字和e-mail地址。Cod_course为唯一识别每个科目值。最后Consulting_hour和Consulting_place表示授课时间和授课的地点。  


CREATE TABLE subjects (
Subject varchar(96) NOT NULL,
Cod_Subject varchar(24) NOT NULL,
Cod_number varchar(12) NOT NULL,
PRIMARY KEY (Cod_subject )
);  

  Subject是科目的名字,Cod_subject是学院采用的代表每个科目的名字,它的值是唯一的,并且是这个表的主键。Cod_number是一个数字的字段,相同科目的不同课程都属于一个组,这个数字就是组的识别号。

CREATE TABLE exams (
Cod_Subject varchar(24) NOT NULL,
Id int(11) NOT NULL,
Date date DEFAULT '0000-00-00',
Time time DEFAULT '00:00:00',
Room varchar(64),
Test varchar(16) DEFAULT 'Oral'
);  

  Cod_subject指学院采用的代表每个科目的名字,是唯一的,ID是教授的唯一识别号,Date, Time和Room用来记录测验举行的日期、时间和地点,Test用来表示测验的类型(包括书面、口头等)

CREATE TABLE teach (
Cod_Subject varchar(16) NOT NULL,
Id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (Id, Cod_subject )
);  

  在teach表中,ID是教授的识别号,Cod_Subject的含义同上,两者构成了该表的主键。

  下一步是在数据库中填入一些数据,这步可以自行完成。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What functions does Doubao app have? What functions does Doubao app have? Mar 01, 2024 pm 10:04 PM

There will be many AI creation functions in the Doubao app, so what functions does the Doubao app have? Users can use this software to create paintings, chat with AI, generate articles for users, help everyone search for songs, etc. This function introduction of the Doubao app can tell you the specific operation method. The specific content is below, so take a look! What functions does the Doubao app have? Answer: You can draw, chat, write articles, and find songs. Function introduction: 1. Question query: You can use AI to find answers to questions faster, and you can ask any kind of questions. 2. Picture generation: AI can be used to create different pictures for everyone. You only need to tell everyone the general requirements. 3. AI chat: can create an AI that can chat for users,

Convert VirtualBox fixed disk to dynamic disk and vice versa Convert VirtualBox fixed disk to dynamic disk and vice versa Mar 25, 2024 am 09:36 AM

When creating a virtual machine, you will be asked to select a disk type, you can select fixed disk or dynamic disk. What if you choose fixed disks and later realize you need dynamic disks, or vice versa? Good! You can convert one to the other. In this post, we will see how to convert VirtualBox fixed disk to dynamic disk and vice versa. A dynamic disk is a virtual hard disk that initially has a small size and grows in size as you store data in the virtual machine. Dynamic disks are very efficient at saving storage space because they only take up as much host storage space as needed. However, as disk capacity expands, your computer's performance may be slightly affected. Fixed disks and dynamic disks are commonly used in virtual machines

The difference between vivox100s and x100: performance comparison and function analysis The difference between vivox100s and x100: performance comparison and function analysis Mar 23, 2024 pm 10:27 PM

Both vivox100s and x100 mobile phones are representative models in vivo's mobile phone product line. They respectively represent vivo's high-end technology level in different time periods. Therefore, the two mobile phones have certain differences in design, performance and functions. This article will conduct a detailed comparison between these two mobile phones in terms of performance comparison and function analysis to help consumers better choose the mobile phone that suits them. First, let’s look at the performance comparison between vivox100s and x100. vivox100s is equipped with the latest

How to add trusted sites in Google Chrome How to add trusted sites in Google Chrome Jul 19, 2024 pm 04:14 PM

How to add trusted sites in Google Chrome? Some users cannot browse the web normally because the page prompts that it is not secure when surfing the Internet. At this time, they can add the website as a trusted site, and we can access it normally and surf the Internet smoothly. The editor below will bring you the steps to add a trusted site in Google Chrome. The steps are simple and easy to operate, and even beginners can easily get started. Friends who need it can learn about it together. How to add a trusted site in Google Chrome: 1. Open Google Chrome and click the three dots in the upper right corner. Click [Settings]. Choose privacy settings and security. (As shown in the picture) 2. Click Website Settings at the bottom of the page. (As shown in the picture) 3. Click on the unsafe content at the bottom of the page. (As shown in the picture) 4. Click the Add button to the right of the Allow option. (As shown in the picture) 5. Lose

What exactly is self-media? What are its main features and functions? What exactly is self-media? What are its main features and functions? Mar 21, 2024 pm 08:21 PM

With the rapid development of the Internet, the concept of self-media has become deeply rooted in people's hearts. So, what exactly is self-media? What are its main features and functions? Next, we will explore these issues one by one. 1. What exactly is self-media? We-media, as the name suggests, means you are the media. It refers to an information carrier through which individuals or teams can independently create, edit, publish and disseminate content through the Internet platform. Different from traditional media, such as newspapers, television, radio, etc., self-media is more interactive and personalized, allowing everyone to become a producer and disseminator of information. 2. What are the main features and functions of self-media? 1. Low threshold: The rise of self-media has lowered the threshold for entering the media industry. Cumbersome equipment and professional teams are no longer needed.

What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? Mar 21, 2024 pm 04:16 PM

As Xiaohongshu becomes popular among young people, more and more people are beginning to use this platform to share various aspects of their experiences and life insights. How to effectively manage multiple Xiaohongshu accounts has become a key issue. In this article, we will discuss some of the features of Xiaohongshu account management software and explore how to better manage your Xiaohongshu account. As social media grows, many people find themselves needing to manage multiple social accounts. This is also a challenge for Xiaohongshu users. Some Xiaohongshu account management software can help users manage multiple accounts more easily, including automatic content publishing, scheduled publishing, data analysis and other functions. Through these tools, users can manage their accounts more efficiently and increase their account exposure and attention. In addition, Xiaohongshu account management software has

PHP Tips: Quickly Implement Return to Previous Page Function PHP Tips: Quickly Implement Return to Previous Page Function Mar 09, 2024 am 08:21 AM

PHP Tips: Quickly implement the function of returning to the previous page. In web development, we often encounter the need to implement the function of returning to the previous page. Such operations can improve the user experience and make it easier for users to navigate between web pages. In PHP, we can achieve this function through some simple code. This article will introduce how to quickly implement the function of returning to the previous page and provide specific PHP code examples. In PHP, we can use $_SERVER['HTTP_REFERER'] to get the URL of the previous page

What is Discuz? Definition and function introduction of Discuz What is Discuz? Definition and function introduction of Discuz Mar 03, 2024 am 10:33 AM

"Exploring Discuz: Definition, Functions and Code Examples" With the rapid development of the Internet, community forums have become an important platform for people to obtain information and exchange opinions. Among the many community forum systems, Discuz, as a well-known open source forum software in China, is favored by the majority of website developers and administrators. So, what is Discuz? What functions does it have, and how can it help our website? This article will introduce Discuz in detail and attach specific code examples to help readers learn more about it.

See all articles