1.配置Hosts文件C:\Windows\System32\drivers\etc\hosts2.D:\wamp\bin\apache\apache2.2.22\conf\httpd.conf查找Include conf/extra/httpd-vhosts.conf,去掉前面的#号3.配置Apache文件D:\wamp\bin\apache\Apache2.2.17\conf\extra
[html] view plain copy <!-- 配置信息 --> <VirtualHost *:80> ServerAdmin webmaster@dummy-host2.hleclerc-PC.ingenidev DocumentRoot "d:/wamp/www/think5/public" ServerName www.kmgfyy120.com ErrorLog "logs/dummy-host2.hleclerc-PC.ingenidev-error.log" CustomLog "logs/dummy-host2.hleclerc-PC.ingenidev-access.log" common </VirtualHost>
去除index.php路径1、如果没有开启 URL_REWRITE,则你需要找到 Apache 中的 httpd.conf 这个配置文件,找到下面这行:#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉,然后继续找到下面这句:2、AllowOverride None将所有找到的以上语句都改为:AllowOverride All以上修改完毕然后重启 Apache 服务器即可。3、在应用的根目录下面新建一个 .htaccess 文件。在文件里面加入如下代码:<IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>
第一步:public目录下 build.php文件添加配置
[php] view plain copy <?php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: liu21st <liu21st@gmail.com> // +---------------------------------------------------------------------- return [ // 生成应用公共文件 '__file__' => ['common.php', 'config.php', 'database.php'], // 定义demo模块的自动生成 (按照实际定义的文件名生成) 'admin' => [ '__file__' => ['common.php'], '__dir__' => ['behavior', 'controller', 'model', 'view'], 'controller' => ['Index', 'User','Config'], 'model' => ['Models', 'ModelsField','Config'], 'view' => ['index/index','config/index'], ], // 其他更多的模块定义 ];
index.pxp修改为:
[php] view plain copy <?php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: liu21st <liu21st@gmail.com> // +---------------------------------------------------------------------- // [ 应用入口文件 ] // 定义应用目录 define('APP_PATH', __DIR__ . '/../application/'); // 加载框架引导文件 require __DIR__ . '/../thinkphp/start.php'; //读取自动生成定义文件 $build = include 'build.php'; //运行自动生成 \think\Build::run($build);
4.在网页上面搜索域名即可
转载于:https://www.cnblogs.com/lxy1023-/p/8555500.html
相关资源:JAVA上百实例源码以及开源项目