julley 发表于 2015-8-25 14:28:00

第一章如何加载运行已发布的PHP项目

  一.安装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
Name
Last modified
Size
Description

  Parent Directory
  
-
  demo1.php
13-Dec-2011 00:33
31
  orderform.php
13-Dec-2011 00:16
871
  postorder.php
14-Dec-2011 22:29
1.1K

Apache/2.2.8 (Win32) PHP/5.2.6 Server at localhost Port 8090  
  点击demo1.php,可看到输出了Hello World.
  
  五. 运行已有php文件
  Orderform.php
<!DOCTYPEhtml 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;
?>
<!DOCTYPEhtml 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
Name
Last modified
Size
Description

  Parent Directory
  
-
  demo1.php
13-Dec-2011 00:15
49
  orderform.php
13-Dec-2011 00:16
871
  postorder.php
13-Dec-2011 00:17
1.0K

Apache/2.2.8 (Win32) PHP/5.2.6 Server at localhost Port 8090  
  
页: [1]
查看完整版本: 第一章如何加载运行已发布的PHP项目