tp5 1 獲取引數 獲取傳值 獲取url

2021-10-02 19:33:30 字數 730 閱讀 1944

<?php

//方法都在

//獲取引數方式一

class test

}//獲取引數方式二 構造方法注入

use think\request;

class test

}//獲取引數方式三 構造方法注入

use think\controller;

class test extends controller

}//獲取引數方式四 助手函式

use think\controller;

class test extends controller

}//獲取引數方式五 facade呼叫

use think\controller;

use think\facade\request;

class test extends controller

}//獲取引數方式六 facade呼叫

use think\facade\request;

class test

}//獲取引數方式七 facade呼叫

use think\facade\request;

class test

}

route.php

route::get('hello/:id','sample/test/hello');

tp5 1 資料庫獲取器

db類也可以支援獲取器定義,例如 db name user withattr name function value,data select 上面的 查詢的資料集資料中的name欄位的值會統一進行小寫轉換。withattr方法可以多次呼叫,對多個字段定義獲取器。支援對json欄位定義獲取器,例如 u...

tp5 1 獲取專案根目錄以及子目錄

5.0和5.1的獲取方式是不一樣的 官方文件 5.0常量 5.1獲取方法 ext取消,固定使用.php is win 取消is cli 取消ds 使用php自帶directory separator env prefix 取消,固定使用php think start time think start...

JS URL傳參 獲取引數

在頁面上直接用url傳參,在url後邊拼接引數,然後在頁面獲取引數。下邊是獲取引數的 裡邊有注釋!var url location.search 獲取url中 符後的字串 aaa 123 bbb 456 var therequest new object if url.indexof 1 conso...