一.安裝AppServ2.5.10
參考安裝文檔
驗證是否安裝成功
Http://localhost:8090/index.php
http://localhost:8090/phpinfo.php
http://localhost:8090/phpmyadmin
username: root password:root
二.下載項目
到http://www.comsenz.com下載免費開源項目Discuz_7.2_FULL_SC_GBK.zip
a.把解壓后的目錄中的upload文件拷貝到D:\AppServ\www,並改名為discuz
b.登錄到 http://localhost:8090/discuz/install,按操作步驟安裝,設置管理員為
username: admin password: admin888
安裝完成即可使用。
c.輸入http://localhost:8090/discuz,選擇默認版塊。
看到下面的頁面,說明安裝成功。
三.到http://www.ecshop.com下載ECShop_V2.7.2_UTF8_Release0604.zip
a.把解壓后的目錄中的upload文件拷貝到D:\AppServ\www,並改名為ecshop.
b.登錄到 http://localhost:8090/ecshop,按操作步驟安裝,設置管理員為
username: admin password: admin888
安裝完成即可使用。
c.輸入http://localhost:8090/ecshop,看到如下頁面,即安裝成功。
四.生成一個自己的項目
打開zend studio 7.2,選擇工作目錄為:D:\AppServ\www
新建一個PHP project ,命名為Basic1
新建一個PHP File,命名為:demo1.php
輸入如下內容:
<?php echo 'Hello World'; ?> |
打開瀏覽器,輸入http://localhost:8090/Basic1/
可看到如下內容
Index of /Basic1
|
點擊demo1.php,可看到輸出了Hello World.
五. 運行已有php文件
Orderform.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>我的第一個PHP程序</title> <style> table { background:#ccc; width:200px; margin:20px auto; } table td { background:#fff; } </style> </head> <body>
<form method="post" action="postorder.php"> <table> <tr><td>您的商品</td><td>價格</td><td>數量</td></tr> <tr><td>蘋果</td><td>2.6元/斤</td><td><input type="text" size="5" name="apple" /></td></tr> <tr><td>豬肉</td><td>13.2元/斤</td><td><input type="text" size="5" name="pig" /></td></tr> <tr><td>餅干</td><td>21元/盒</td><td><input type="text" size="5" name="biscuit" /></td></tr> <tr><td colspan="3" align="center"><input type="submit" value="發送訂單" /></td></tr> </table> </form>
</body> </html> |
Postorder.php
<?php $apple=$HTTP_POST_VARS['apple']; $pig=$HTTP_POST_VARS['pig']; $biscuit=$HTTP_POST_VARS['biscuit'];
$apple=$apple*2.6; $pig=$pig*13.2; $biscuit=$biscuit*21;
$sum=$apple+$pig+$biscuit; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>我的第一個PHP程序</title> <style> table { background:#ccc; width:200px; margin:20px auto; } table td { background:#fff; } </style> </head> <body>
<form method="post" action="postorder.php"> <table> <tr><td>您的商品</td><td>價格</td><td>小記</td></tr> <tr><td>蘋果</td><td>2.6元/斤</td><td><?echo $apple ?></td></tr> <tr><td>豬肉</td><td>13.2元/斤</td><td><?echo $pig ?></td></tr> <tr><td>餅干</td><td>21元/盒</td><td><?echo $biscuit ?></td></tr> <tr><td colspan="3" align="center">一共要支付<?echo $sum ?>元 [<a href="orderform.php">返回修改</a>]</td></tr> </table> </form>
</body> </html> |
輸入url:http://localhost:8090/Basic1/
看到如下頁面
Index of /Basic1
|