PHPStorm 對 ThinkPHP6.0 沒有代碼提示


PHPStorm再模型操作ThinkPHP6.0的時候沒有代碼提示特別的不習慣也不方便

就找到了ThinkPHP5.1里面的代碼注釋,復制了一遍給到了兩個文件

# 以前的最好也不好刪

第1步、
第一個找到Model.php 

文件路徑   vendor\topthink\think-orm\src\Model.php   

也可以Ctrl + Shift + N 搜索文件   Model.ph

 添加代碼注釋:

* @method Query where(mixed $field, string $op = null, mixed $condition = null) static 查詢條件
 * @method Query whereTime(string $field, string $op, mixed $range = null) static 查詢日期和時間
 * @method Query whereBetweenTime(string $field, mixed $startTime, mixed $endTime) static 查詢日期或者時間范圍
 * @method Query whereBetweenTimeField(string $startField, string $endField) static 查詢當前時間在兩個時間字段范圍
 * @method Query whereYear(string $field, string $year = 'this year') static 查詢某年
 * @method Query whereMonth(string $field, string $month = 'this month') static 查詢某月
 * @method Query whereDay(string $field, string $day = 'today') static 查詢某日
 * @method Query whereRaw(string $where, array $bind = []) static 表達式查詢
 * @method Query whereExp(string $field, string $condition, array $bind = []) static 字段表達式查詢
 * @method Query when(mixed $condition, mixed $query, mixed $otherwise = null) static 條件查詢
 * @method Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查詢
 * @method Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 視圖查詢
 * @method Query with(mixed $with) static 關聯預載入
 * @method Query count(string $field) static Count統計查詢
 * @method Query min(string $field) static Min統計查詢
 * @method Query max(string $field) static Max統計查詢
 * @method Query sum(string $field) static SUM統計查詢
 * @method Query avg(string $field) static Avg統計查詢
 * @method Query field(mixed $field, boolean $except = false) static 指定查詢字段
 * @method Query fieldRaw(string $field, array $bind = []) static 指定查詢字段
 * @method Query union(mixed $union, boolean $all = false) static UNION查詢
 * @method Query limit(mixed $offset, integer $length = null) static 查詢LIMIT
 * @method Query order(mixed $field, string $order = null) static 查詢ORDER
 * @method Query orderRaw(string $field, array $bind = []) static 查詢ORDER
 * @method Query cache(mixed $key = null, integer $expire = null) static 設置查詢緩存
 * @method mixed value(string $field) static 獲取某個字段的值
 * @method array column(string $field, string $key = '') static 獲取某個列的值
 * @method Model find(mixed $data = null) static 查詢單個記錄 不存在返回Null
 * @method Model findOrEmpty(mixed $data = null) static 查詢單個記錄 不存在返回空模型
 * @method \think\model\Collection select(mixed $data = null) static 查詢多個記錄
 * @method Model withAttr(array $name, \Closure $closure) 動態定義獲取器

 

第2步、
第一個找到DbManager.php 

文件路徑  vendor\topthink\think-orm\src\DbManager.php

也可以Ctrl + Shift + N 搜索文件   DbManager.php

添加代碼注釋:

* @method \think\db\Query master() static 從主服務器讀取數據
 * @method \think\db\Query readMaster(bool $all = false) static 后續從主服務器讀取數據
 * @method \think\db\Query table(string $table) static 指定數據表(含前綴)
 * @method \think\db\Query name(string $name) static 指定數據表(不含前綴)
 * @method \think\db\Query where(mixed $field, string $op = null, mixed $condition = null) static 查詢條件
 * @method \think\db\Query whereRaw(string $where, array $bind = []) static 表達式查詢
 * @method \think\db\Query whereExp(string $field, string $condition, array $bind = []) static 字段表達式查詢
 * @method \think\db\Query when(mixed $condition, mixed $query, mixed $otherwise = null) static 條件查詢
 * @method \think\db\Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查詢
 * @method \think\db\Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 視圖查詢
 * @method \think\db\Query field(mixed $field, boolean $except = false) static 指定查詢字段
 * @method \think\db\Query fieldRaw(string $field, array $bind = []) static 指定查詢字段
 * @method \think\db\Query union(mixed $union, boolean $all = false) static UNION查詢
 * @method \think\db\Query limit(mixed $offset, integer $length = null) static 查詢LIMIT
 * @method \think\db\Query order(mixed $field, string $order = null) static 查詢ORDER
 * @method \think\db\Query orderRaw(string $field, array $bind = []) static 查詢ORDER
 * @method \think\db\Query cache(mixed $key = null , integer $expire = null) static 設置查詢緩存
 * @method \think\db\Query withAttr(string $name,callable $callback = null) static 使用獲取器獲取數據
 * @method mixed value(string $field) static 獲取某個字段的值
 * @method array column(string $field, string $key = '') static 獲取某個列的值
 * @method mixed find(mixed $data = null) static 查詢單個記錄
 * @method mixed select(mixed $data = null) static 查詢多個記錄
 * @method integer insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) static 插入一條記錄
 * @method integer insertGetId(array $data, boolean $replace = false, string $sequence = null) static 插入一條記錄並返回自增ID
 * @method integer insertAll(array $dataSet) static 插入多條記錄
 * @method integer update(array $data) static 更新記錄
 * @method integer delete(mixed $data = null) static 刪除記錄
 * @method boolean chunk(integer $count, callable $callback, string $column = null) static 分塊獲取數據
 * @method \Generator cursor(mixed $data = null) static 使用游標查找記錄
 * @method mixed query(string $sql, array $bind = [], boolean $master = false, bool $pdo = false) static SQL查詢
 * @method integer execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) static SQL執行
 * @method \think\Paginator paginate(integer $listRows = 15, mixed $simple = null, array $config = []) static 分頁查詢
 * @method mixed transaction(callable $callback) static 執行數據庫事務
 * @method void startTrans() static 啟動事務
 * @method void commit() static 用於非自動提交狀態下面的查詢提交
 * @method void rollback() static 事務回滾
 * @method boolean batchQuery(array $sqlArray) static 批處理執行SQL語句
 * @method string getLastInsID(string $sequence = null) static 獲取最近插入的ID

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM