Home Backend Development PHP Tutorial 建立动态的WML站点_PHP

建立动态的WML站点_PHP

Jun 01, 2016 pm 12:29 PM
NOT null varchar dynamic Establish

支持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 Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
Fix: Windows 11's dynamic refresh rate doesn't work Fix: Windows 11's dynamic refresh rate doesn't work Apr 13, 2023 pm 08:52 PM

You can measure a screen's refresh rate by counting the number of times the image updates per second. DRR is a new feature included in Windows 11 that helps you save battery life while still providing a smoother display, but it's no surprise when it doesn't work properly. Screens with higher refresh rates are expected to become more common as more manufacturers announce plans to stop producing 60Hz monitors. This will result in smoother scrolling and better gaming, but it will come at the cost of reduced battery life. However, the dynamic refresh rate feature in this iteration of the OS is a nifty addition that can have a big impact on your overall experience. Read on as we discuss what to do if Windows 11’s dynamic refresh rate isn’t working

How to Hide Dynamic Island and Red Indicator in iPhone Screen Recording How to Hide Dynamic Island and Red Indicator in iPhone Screen Recording Apr 13, 2023 am 09:13 AM

On iPhone, Apple's screen recording feature records a video of what you're doing on the screen, which is useful if you want to capture gameplay, walk someone through a tutorial in an app, demonstrate a bug, or anything else. On older iPhones that have a notch at the top of the display, the notch is not visible in screen recording, as it should be. But on newer iPhones with the ‌Dynamic Island‌ cutout, such as the ‌iPhone 14 Pro‌ and ‌iPhone 14 Pro‌ Max, the ‌Dynamic Island‌ animation displays the red recording indicator, which causes the cutout to be visible in captured videos. this might

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

How to convert dynamic disk to basic disk on Windows 11 How to convert dynamic disk to basic disk on Windows 11 Sep 23, 2023 pm 11:33 PM

If you want to convert a dynamic disk to a basic disk in Windows 11, you should create a backup first as the process will erase all data in it. Why should you convert dynamic disk to basic disk in Windows 11? According to Microsoft, dynamic disks have been deprecated from Windows and their use is no longer recommended. Additionally, Windows Home Edition does not support dynamic disks, so you will not be able to access these logical drives. If you want to combine more disks into a larger volume, it is recommended to use Basic Disks or Storage Spaces. In this article, we will show you how to convert dynamic disk to basic disk on Windows 11 How to convert dynamic disk to basic disk in Windows 11? In the beginning

How to Get Live Tiles on the Desktop and Start Menu in Windows 11 How to Get Live Tiles on the Desktop and Start Menu in Windows 11 Apr 14, 2023 pm 05:07 PM

Imagine you are looking for something on your system but are not sure which application to open or select. This is where the Live Tiles feature comes into play. A live tile for any supported application can be added to the desktop or Windows system's Start menu, with its tiles changing frequently. LiveTiles make application widgets come alive in a very pleasing way. Not just for its appearance, but even for convenience. Suppose you are using whatsapp or facebook application on your system, wouldn't it be convenient if the number of notifications is displayed on the application icon? This is possible if any such supported app is added as a live tile. Let’s see how to do it in Windows

Understand the importance of establishing linked files in Linux Understand the importance of establishing linked files in Linux Feb 22, 2024 pm 07:24 PM

Title: In-depth discussion of the importance and examples of establishing link files in Linux. In the Linux operating system, link files are a very useful concept. It can help users better organize and manage data in the file system and improve file accessibility. Accessibility and flexibility. Understanding how to create link files in Linux is crucial for system administrators and developers. This article will delve into the importance of establishing link files in Linux and demonstrate its usage and role through specific code examples. 1.What is

How to create a WeChat group How to create a WeChat group How to create a WeChat group How to create a WeChat group Feb 22, 2024 pm 03:46 PM

Select the plus button on the homepage, then select Start a group chat, check the contacts you want to create a group, and then complete. Tutorial Applicable Model: iPhone13 System: IOS15.3 Version: WeChat 8.0.20 Analysis 1 First open WeChat and click the plus button in the upper right corner of the homepage. 2 Next, click the option to initiate a group chat in the pop-up window. 3Finally, check the contacts you want to create a group on the page and click Finish. Supplement: What is WeChat group chat? 1 WeChat chat group is a multi-person chat and communication network platform developed by Tencent. We can use the Internet to quickly transmit voice messages, short videos, high-definition pictures and text content. You can also use WeChat to communicate with friends in more colorful forms such as short messages, mobile MMS, etc.

How to disable dynamic display of folders and files to prevent quick access in Windows 10 and 11? How to disable dynamic display of folders and files to prevent quick access in Windows 10 and 11? May 06, 2023 pm 04:58 PM

Microsoft introduced Quick Access in Windows 10 and retained the feature in the recently released Windows 11 operating system. Quick Access replaces the Favorites system in File Explorer. One of the core differences between the two features is that Quick Access adds a dynamic component to its list. Some folders appear permanently, while others appear based on usage. Fixed folders are displayed with a pin icon, while dynamic folders do not have such an icon. You can see a comparison between My Favorites and Quick Access here for more details. Quick Access is more powerful than Favorites, but dynamic folder lists add an element of clutter to it. Files that are useless or should not be highlighted in File Explorer may be displayed

See all articles