1、創建項目根目錄,配置虛擬主機
1.1、創建項目根目錄phpDemo01,將thinkphp_3.2.3_full.zip壓縮包中ThinkPHP文件夾復制到項目根目錄phpDemo01中。
1.2、主機名localhost,端口80,站點目錄設置為項目根目錄phpDemo01
配置文件httpd.conf
在hosts文件配置:
重啟apache服務:win10系統,搜索"服務"
1.3、測試
瀏覽器輸入http://web.abc123.com/,OK。將我上一篇博客 php(一)搭建php開發環境 的a.php文件復制到項目根目錄phpDemo01中。瀏覽器輸入http://web.abc123.com/a.php,測試OK。
2、創建基於thinkphp的項目
在項目根目錄phpDemo01下面創建子項目helloworldProject,新建index.php
<?php //入口文件 include("../ThinkPHP/ThinkPHP.php");
瀏覽器訪問項目helloworldProject的index.php后會自動創建Common、Home、Runtime三個文件夾。
3、新建UserController.class.php
瀏覽器訪問:
http://web.abc123.com/helloworldProject/index.php?m=Home&c=user&a=add
http://web.abc123.com/helloworldProject/index.php?c=user&a=add
http://web.abc123.com/helloworldProject/index.php/Home/user/add