安装
- 进入php项目目录 www文件下 使用 composer create-project topthink/think=5.1.* tp1.1test 安装think项目
伪静态url传值:
http://localhost/tp1.1test/public/index.php/module/test/func/who/dzx
http://localhost/tp1.1test/public/index.php:项目路由
module:模块
test: 控制器
func:操作,function方法
who:function的参数
dzx:传的值
不开启伪静态url传值使用:
http://localhost/tp1.1test/public/index.php?s=module/test/func/who/dzx
怎么开启伪静态
打开apache,打开httpd.conf文件,加载mod_rewrite,so, 去掉前面的#号,然后重启
url去掉index.php, 同时解决phpstudy自动生成不生效问题,替换掉倒数第二行:
根目录下public 文件 里面配置.htaccess文件,
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>