为了账号安全,请及时绑定邮箱和手机立即绑定

thinkphp5的访问路径问题

thinkphp5的访问路径问题

PHP
大写的王 2017-12-25 18:13:44
为什么我的thinkPHP5访问控制器 必须要localhost/项目名称/public/index.php/admin/index/index这种才能访问,怎么去掉public,并且按照收藏隐藏入口文件并不成功
查看完整描述

1 回答

已采纳
?
黄小凡

TA贡献69条经验 获得超36个赞

以管理员身份编辑C:\Windows\System32\drivers\etc\hosts 文件,添加一行

127.0.0.1       www.想设置的域名.com

然后在Apache下的httpd-vhosts 添加该域名访问目录

<VirtualHost *:80>
	ServerName www.想设置的域名.com
	DocumentRoot D:/wamp64/www/tptest/public  //你对应的thinkphp5的public目录
	<Directory  "D:/wamp64/www/tptest">   //你对应的thinkphp5的public目录
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Require local
	</Directory>
</VirtualHost>

重启服务器,这个时候打开  www.想设置的域名.com,就能访问到

查看完整回答
反对 回复 2017-12-26
  • 1 回答
  • 0 关注
  • 3526 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信