thinkphp6 多入口檔案的應用和隱藏

2021-10-03 04:04:08 字數 762 閱讀 9772

1.在public下建2個入口檔案,分別是

admin.php     代表後台

index.php     代表前台

2.在route檔案下,分別建前後臺的路由檔案

<?php

use think\facade\route;

route::get('admin/', 'index/index');

route::get('admin/weclome', 'index/weclome')->name('weclome');

<?php

use think\facade\route;

route::get('', 'index/index');

route::get('hello', 'index/hello');

3.public 目錄下的.htaccess檔案裡如下圖這樣寫

options +followsymlinks -multiviews

rewriteengine on

rewritecond % !-d

rewritecond % !-f

rewriterule ^admin(.*)$ admin.php [l,e=path_info:$1]

rewriterule !^index(.*)$ index.php/index/ [l,e=path_info:$1]

到這裡多入口應用入口檔案就隱藏了,試試吧

ThinkPHP(6) 模板技術

判斷比較標籤 區間標籤 三元運算子 php 在如下圖所示目錄中建立html 然後在index控制器的index方法中,呼叫模板 那麼當你訪問 index index時就會顯示index.html。如果你不想要模板和方法同名,你可以在display方法中跟上模板名稱即可。如下圖 兩種方式賦值 clas...

thinkphp6 七牛雲 檔案上傳

新增頁面 public function index 處理新增頁面 獲取資料 獲取表單上傳檔案 例如上傳了001.jpg key input post.key image request file image 獲取上傳後的檔案路徑 儲存在本地的臨時路經 filepath image getrealp...

thinkphp6陣列分頁

一 因為有複雜的資料統計,需要組陣列,這時候使用tp6的分頁會有問題,於是改為陣列分頁的方式,將以前tp3的分頁拿過來改了一下,話不多說上 引入tp3分頁源 為了和tp6的區別不會太明顯,修改了源 放入tp6 vendor topthink framework src think 下 修改詳情 1 ...