[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
PhpStorm配置CodeIgniter(CI)框架的代码智能提示自动补全
痛点
* PhpStorm 里面没有CI框架的自动提示,model 找方法很抓狂?($this->load 之后再无下文)
* model 的方法没有自动提示,每次都要对照着model结构图来写。($this->xxx_model-> 之后再无下文)
* 要达到的效果: PhpStorm支持CI的各种书写格式,提高开发效率。
解决思路
利用注释的 @property 来映射对应的类
@property 类名 实列名
举个栗子
实现 model自定义类 this->db 链式提示提示
Model 的 this->db 链式提示,我们在 自定义model类 添加相应的@property 注释指定 CI_DB_query_builder 类即可
/** * @property CI_DB_query_builder $db */ class Orderqueue_model extends
MY_Model { } 实现 library自定义类 提示
自定义代码会放在libraries里面,并且会放在一个单独的子文件夹里。那么这种自定义类代码如何做代码提示?跟model是一样的,@property 注释指定
CI_Queue 类即可
/** * Class Queue * @property CI_Queue $queue */ class Queue extends
AdminController { protected $max_num = 5; public function __construct() {
parent::__construct(); $this->load->library('Queue', '', 'queue');
$this->queue->get_list();// 会自动提示 } }
总结
网上流传的更多方法的是,先从Git下载别人写好的类文件,然后在你项目的External Libraries上右键->Configure PHP
Include Path,接下来 Make as Plain Text
。本人不建议采纳这样做,其实没这么费劲,很简单的一步到位,添加@property注解指定文件就可以啦。