thinkphp5 0 URL 位址生成

2022-08-29 01:24:08 字數 1199 閱讀 1812

使用系統類

使用助手函式

<?php

use think\url;

//輸出首頁位址

url::build('index/index/index');

//這個也是輸出首頁位址

url('index/index/index');

帶引數的url位址
<?php

use think\url;

//輸出首頁位址

url::build('index/index/index','id=5&name=lizhi');

url::build('index/index/index',['id'=>5,'name'='lizhi']);

//這個也是輸出首頁位址

url('index/index/index','id=5&name=lizhi');

url('index/index/index',['id'=>5,'name'='lizhi']);

帶網域名稱的url位址
<?php

use think\url;

url::build('index/index/index@bolg');

url('index/index/index@bolg');

//相當於,新增二級網域名稱bolg

//下面是完整格式

url::build('index/index/index','id=5','shtml','www.lizhi.com');

url('index/index/index','id=5','shtml','www.lizhi.com');

新增和刪除 入口檔案
<?php

use think\url;

//先用root 在生成url就可以了,下面是新增入口

url::root('/index.php');

url::build('index/index/index','id=5','shtml','www.lizhi.com');

//下面是刪除入口檔名稱,預設是刪除掉的

url::root('/');

url::build('index/index/index','id=5','shtml','www.lizhi.com');

ThinkPHP5 0學習 URL訪問

tp5支援path info和相容模式 示例 created by phpstorm.user wybing date 2019 7 16 time 14 13 class manager 通過path info方式訪問 通過相容模式方式訪問 輸入 推薦path info方式 url大小寫問題 1....

thinkPHP5 0框架URL訪問方法詳解

url設計 thinkphp5.0在沒有啟用路由的情況下典型的url訪問規則是 http servername index.php 或者其它應用入口檔案 模組 控制器 操作 引數名 引數值.支援切換到命令列訪問,如果切換到命令列模式下面的訪問規則是 php.exe index.php 或者其它應用入...

thinkphp3 2 url位址大小寫設定

在config.php 裡邊對url 大小寫敏感進行設定 引入檔案 include hello.php include hello.php 實際都會把指定檔案找到 hello.php tp框架本身自己做了額外設定 include hello.php include hello.php 表示需要引入兩...