課程
/后端開發(fā)
/ThinkPHP
/快速入門ThinkPHP 5.0--基礎(chǔ)篇
打開localhost/index/Index/index顯示沒有服務(wù)
2018-06-15
源自:快速入門ThinkPHP 5.0--基礎(chǔ)篇 2-5
正在回答
在控制器下輸入 php -S localhost:8888 router.php 在瀏覽器輸入 localhost:8888/index/index/index
這是因為沒有把PHP的后綴用APACHE的URL重寫規(guī)則隱藏導(dǎo)致的
在入口文件目錄找到文件.htaccess,中添加一段代碼
<IfModule mod_rewrite.c>?RewriteEngine on?RewriteCond %{REQUEST_FILENAME} !-d?RewriteCond %{REQUEST_FILENAME} !-f?RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]</IfModule>#以上是去掉index.php的代碼
<IfModule mod_rewrite.c>
?RewriteEngine on
?RewriteCond %{REQUEST_FILENAME} !-d
?RewriteCond %{REQUEST_FILENAME} !-f
?RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
#以上是去掉index.php的代碼
慕前端1555222
Gp新的一天 回復(fù) 慕前端1555222
你不設(shè)置隱藏入口文件這種訪問格式肯定是會報錯的
舉報
ThinkPHP5已發(fā)布多時,想了解ThinkPHP5的新特性嗎?老司機(jī)帶你馬上出發(fā)~
1 回答http://localhost/TP5/app/Index/Index/index
2 回答http://localhost/admin/Index/index
2 回答訪問http://localhost:/index/Index/index失敗
2 回答訪問localhost/index/index/index提示有問題
3 回答為什么我訪問localhost/tp5/public可以訪問 但是localhost/tp5/public/index/Index/Index就出現(xiàn)404錯誤呢
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2018-07-07
在控制器下輸入
php -S localhost:8888 router.php
在瀏覽器輸入
localhost:8888/index/index/index
2018-06-24
這是因為沒有把PHP的后綴用APACHE的URL重寫規(guī)則隱藏導(dǎo)致的
在入口文件目錄找到文件.htaccess,中添加一段代碼
2018-06-15
你不設(shè)置隱藏入口文件這種訪問格式肯定是會報錯的