1.Think PHP框架搭建
(1)WampServer下载以及安装
下载完成后直接安装,安装中一直下一步就行。但是你要注意你安装的目录。
(2)WampServer的配置
启动WampServer,修改httpd.conf中的配置,httpd.conf的路径如下图所示。
若出现You don't havepermission to access / on this server.
需要修改一下php的配置文件httpd.conf。
在原有的位置文件中找到配置节,修改成
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
# Deny from all
Allow from all
#允许所有访问
Satisfy all
</Directory>
还有
<Directory"D:/Wamp/www">
#
# Possible values for the Options directiveare "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must benamed *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicatedand important. Please see
#http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directivesmay be placed in .htaccess files.
# It can be "All","None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from thisserver.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
修改成
<Directory"D:/Wamp/www">
#
# Possible values for the Options directiveare "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must benamed *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicatedand important. Please see
#http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directivesmay be placed in .htaccess files.
# It can be "All","None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from thisserver.
#
# onlineoffline tag - don't remove
Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
Allow from all
</Directory>
然后保存,重启服务,在访问就解决了这个问题。
phpmyadmin的配置如下(路径为wamp/alias/phamyadmin.conf)
(3)搭建ThinkPHP框架
一、下载ThinkPHP
网址:http://www.thinkphp.cn/下载你需要的版本(下载完整版,不要下载核心版)
二、搭建ThinkPHP
在www文件夹中新建一个文件夹(我建的是think),将下载的ThinkPHP中的ThinkPHP拷贝到think文件夹里面。
新建一个.php(index.php),代码如下所示(其中Index文件是运行后生成的)可能有的ThinkPHP版本还需要在第三行下面定义define('RUNTIME_PATH',APP_PATH.'Temp/');//定义编译目录位置。
三、搭建文成结果展示
在浏览器中输入127.0.0.1/think/index.php出现如下内容,同时生成Index文件夹。
控制器文件找到IndexAction.class.php(目录如下图所示),运行输出Hello,World,说明安装成功。