网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > 代码交流
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

代码交流 ASP,PHP,JSP等网站源代码下载与交流。

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   IP: 218.2.29.60
Old 2006-12-15, 08:31 PM
sunshine sunshine is offline
高级会员
 
Join Date: 2006-01-05
Posts: 368
sunshine 正向着好的方向发展
Default 浅谈php语法(4)

文件:deal.php
以上程序会要求用户输入一个用户名,提交表单后,后回用户名确认信息。可看出,表单中的uname已成为了deal.php程序中的$uname变崐量。简单吧。:-)
下面看看PHP的基本流程控制:
if…else…Elseif
语法一:
if (条件) {
语句体
}
语法二:
if (条件) {
语句体一
}else{
语句体二
}
语法三:
if (条件1) {
语句体一
}elseif(条件2) {
语句体二
}else{
语句体三
}
我们把上面的deal.php程序改为:

除了if 语句外,还有while循环,它的语法如下:
while(条件){
语句体
}
当条件为true时,执行语句体。
do…while的语法如下:
do {
语句体
}while(条件)
先执行一次语句体,若条件为true,则循环再次执行语句体。
for循环的语法同C一样,如下:
for (条件初始;判断条件;条件改变) {语句}
而break 跳出正在执行的循环,continue 为中断本次循环。
好了,本文就到这吧。以上的一些基础相信您很快便能上手了的。
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:08 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.