win 7下的php 第一天
(1)下载安装工具 wampServer
(2)排除obstacle,
先关闭iis
1)关闭iis服务 iisadmin
2)关闭iis下的虚拟主机实例,默认的网站(中间现实一个IIS的大jpg图像,指向iis.net),
win7下 “控制面板” - “管理工具” “IIS管理器” 删除应用即可。
如果使用端口查看器,会发现,80端口被系统所占用了,尽管进程选项中并没有出现iisadmin这一项,但是它被默认启动了,
被装入了windows的服务项,也就是说,只要你在iis上设置了这个虚拟目录,那么它就会在你登陆windows的时候把它装载进来,并且
占用了你的80端口,
使我的apache用不了(因为占用了80端口)
好了,现在我已经成功的进入了我的wampServer了。
真令人高兴啊。~~
http://localhost
http://localhost/phpmyadmin
创建了一个汽车商店的表单,提交给processorder.php处理,
显示处理的结果。
myphp.php
myphp.php<form action='processorder.php' method="post"><table align="center" border="0"><tr bgcolor="#cccccc"><td>Item</td><td>Quantity</td></tr><tr><td>Tires</td><td><input name='tireqty' type="textbox" size='3' maxlength="3"/></td></tr><tr><td>Oil</td><td><input name='oilqty' type="textbox" size='3' maxlength='3'/></td></tr><tr><td>Spark Plugs</td><td><input name='sparkqty' type="textbox" size='3' maxlength='3'/></td></tr><tr><td>How did you find Bob's?</td><td><select name="find"> <option value="a">I'm a regular customer</option> <option value="b">TV advertising</option> <option value="c">Phone directory</option> <option value="d">Word of mouth</option> </select></td></tr><tr><td colspan="2" align=center><input type="submit" value="submit Order" /> </td></tr></table></form>
processorder.php
processorder.php<html><head><title>simplyman's auto parts - order results</title></head><script type="text/css">.blue {color:blue};</script><body><h1>Bob's auto parts</h1><h2>Order results</h2><?php echo '<p> Order processed at '. date('H:i, js F').'</p>'; //$tireqty; //$_POST[_'tireqty'] //$HTTP_POST_VARS[ 'tireqty'] $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; /* echo '<p>Your order is as follows :</p>'; echo $tireqty. ' tires<br />'; echo $oilqty. ' oils <br />'; echo $sparkqty.' sparks<br />'; */ //echo '$sparkqty sparks '; /* echo <<<theEnd line 1 line 2 line 3 theEnd */ $totalqty = 0; $totalqty =$tireqty +$oilqty +$sparkqty; if($tireqty <10){ $discount = 0; }elseif(($tireqty >= 10) && ($tireqty <= 49)){ $discount = 5; }elseif(($tireqty >= 50 )&&($tireqty <= 99)){ $discount = 10; }elseif($tireqty >=100){ $discount = 15 ; } if($totalqty == 0): echo '<p style=color:red>'; echo "You didn't order anything on the previous page! <br />"; echo '</p>'; exit; endif; /* if($totalqty == 0 ){ echo '<p style=color:red>'; echo "You didn't order anything on the previous page! <br />"; echo '</p>'; exit; } else { if($tireqty > 0 ) echo $tireqty. ' tires<br />'; if($oilqty >0) echo $oilqty. ' bottles of oils <br />'; if($sparkqty > 0) echo $sparkqty.' sparks<br />'; } */ $find=$_POST['find']; switch($find){ case 'a' : echo "<p class=blue>Regular customer.</p>"; break; case 'b': echo "<p class=blue>Customer referred by TV advert.</p>"; break; case "c": echo "<p class=blue>cusomer referred by phone directory</p>"; break; case "d": echo "<p class=blue>Customer referred by word of mouth.</p>"; break; default: echo "<p class=blue>we do not know how this costmer found us.</p>"; break; } echo "Item ordered :".$totalqty."<br />"; $totalamount = (float)$totalqty ; //$varname ='tireqty'; //$$varname= 5; $tireqty = 5'; define('TIREPRICE',100); define('OILPRICE',10); define('SPARKPRICE',4); //echo TIREPRICE.' tireprice<br />'; $totalamount =0.00 ; $totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE ; echo "Subtotal :$" .number_format($totalamount,2)."<br />"; $taxrate = 0.10 ;//local sales tax is 10% $totalamount = $totalamount * (1 + $taxrate); echo "Total including tax :".number_format($totalamount,2)."<br />"; $a = 56 ; echo gettype($a).'<br />'; settype($a,'double'); echo gettype($a)."<br />"; echo 'isset($tireqty,$oilqty,$sparkqty):'.isset($tireqty,$oilqty,$sparkqty).'<br />'; echo 'isset($nothere):'.isset($nothere).'<br />'; echo 'empty($tireqty):'.empty($tireqty).'<br />'; echo 'empty($nothere):'.empty($nothere).'<br />'; ?> <br /><br /><br /><br /> </body></html><?php // here is a comment ?> here is not <?php echo "<p> Order processed</p>" ?> <br /> <?php echo date('H:i, jS F'); phpinfo(); ?>