寫PHP/WML程式碼
現在我們寫首個PHP/WML頁面,名字是index.wml
Header("Content-type: text/vnd.wap.wml");
Header("Cache-Control: no-cache, must-revalidate"); no
Header("Pragma:Header("Pragma:Header("Pragma:Header("Pragma:Header("Pragma:Header("Pragma:Header("Pragma): -cache");
echo ("");
? >
"http://www.wapforum.org/DTD/wml_1.1.xml" >
<WML>
<CARD id=card1 title=UNITO/Database>< You can search for professors' consulting hours or for examinations timetables.
<SELECT name=choice title=Research value="1"> <OPTION selected value=exams_data> >Consulting hours</OPTION></SELECT>
<DO type="text" label="Go">
<GO href="index2.FIwml#card2" method="get">
<POSTFIwml value="$(choice)" name="choice">
</GO>
</DO>
</P>
</CARD>
</WML> 🎜> 第一行告訴瀏覽器該文件的MIME類型,如果沒有頭檔的話,瀏覽器是不懂得接收的是屬於什麼類型的內容,而且有了這一行的話,文件的副檔名就不重要了。對於你想寫一個多樣式的頁面,這個功能是十分有用的,你可以透過一個腳本來偵測裝置或它的效能,然後根據瀏覽器的類型回傳WML或HTML。
檢查PHP是否已經裝有短標籤支援。如果是的話,你可以做一個類似的聲明,並且將它嵌套到PHP程式碼中以免混淆。
該頁面的餘下程式碼只是讓你搜尋測驗的時間或諮詢的時間。所選的項目會記錄在$choice變數中。
下一頁稱為index2.wml,讓你選擇透過科目還是姓氏來查詢資料庫。
Header("Content-type: text/vnd.wap.wml");
Header("Cache-Control: no-cache, must-revalidate");
Header("Pragma: no-revalidate");
Header("Pragma: no- cache");
echo ("");
? >
"http://www.wapforum.org/DTD/wml_1.1.xml" >
<WML>
<CARD id=card2 title="Kind of research">
< P><BR>echo ("You are checking ");
if ($choice == "exams_data") {
echo (" examinations timetables.<BR>
echo (" examinations timetables.<BR>n"); $choice == "consulting_data") {
echo (" consulting hours.<BR>n"); <BR>} else { <BR>echo ("I don't know and there is <BR>echo ("I don't know and there is whatblem. BR>n");
}
? >
<P><BR>You can search by surname (either exact or partial) or by subject (either exact 或 partial).<>< 🎜><SELECT name="" value="surname" title="research"> <OPTION selected value=surname>professor's name</OPTION> <OPTION value=subject>subject</OPTION>
以上就介紹了when christmas comes to town 建立動態的WML站點二,包括了when christmas comes to town方面的內容,希望對PHP教程有興趣的朋友有所幫助。