首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PhpStorm不识别类中的CodeIgniter v3.0数据库方法

PhpStorm不识别类中的CodeIgniter v3.0数据库方法
EN

Stack Overflow用户
提问于 2015-08-23 22:31:20
回答 2查看 2.4K关注 0票数 2

虽然关于如何让PhpStorm识别CodeIgniter 2.x核心函数有很多答案,但我不知道如何让它识别CodeIgniter 3.0数据库函数。

我的配置目录中有一个autocomplete.php文件,它非常适合CodeIgniter 2.x (以及大多数版本3.0)。由于v3删除了活动记录类,因此不再识别DB函数。

代码语言:javascript
复制
 // help IDE(s) support Codeigniter 2.0
  * @property CI_DB_active_record $db  <-- no longer valid.
  ...
 */

如何使PhpStorm自动完成与新的CI v3 DB类一起工作?

更新:这是我的autocomplete.php文件:

代码语言:javascript
复制
<?php
// help IDE(s) support Codeigniter 2.0
/**
 * @property CI_DB_query_builder $db
 * @property CI_DB_forge $dbforge
 * @property CI_Benchmark $benchmark
 * @property CI_Calendar $calendar
 * @property CI_Cart $cart
 * @property CI_Config $config
 * @property CI_Controller $controller
 * @property CI_Email $email
 * @property CI_Encrypt $encrypt
 * @property CI_Exceptions $exceptions
 * @property CI_Form_validation $form_validation
 * @property CI_Ftp $ftp
 * @property CI_Hooks $hooks
 * @property CI_Image_lib $image_lib
 * @property CI_Input $input
 * @property CI_Language $language
 * @property CI_Loader $load
 * @property CI_Log $log
 * @property CI_Model $model
 * @property CI_Output $output
 * @property CI_Pagination $pagination
 * @property CI_Parser $parser
 * @property CI_Profiler $profiler
 * @property CI_Router $router
 * @property CI_Session $session
 * @property CI_Sha1 $sha1
 * @property CI_Table $table
 * @property CI_Trackback $trackback
 * @property CI_Typography $typography
 * @property CI_Unit_test $unit_test
 * @property CI_Upload $upload
 * @property CI_URI $uri
 * @property CI_User_agent $user_agent
 * @property CI_Validation $validation
 * @property CI_Xmlrpc $xmlrpc
 * @property CI_Xmlrpcs $xmlrpcs
 * @property CI_Zip $zip
 *
 *
 *
 * These are samples entries to make my own functions work. Remove these and add you custom ones.

 * @property Tank_auth $tank_auth
 * @property Users_model $users_model
 * @property Firms_model $firms_model
 * @property Event_types_model $event_types_model
 * @property Files_model $files_model
 * @property Milestones_model $milestones_model
 *
 *
 */
class CI_Controller {}; class MY_Controller extends CI_Controller {}; class Welcome extends MY_Controller {}; class Admin_Controller extends MY_Controller {}; class CI_Model {}; class MY_Model extends CI_Model {};/**
 * @property CI_DB_query_builder $db
 * @property CI_DB_forge $dbforge
 * @property CI_Config $config
 * @property CI_Loader $load
 * @property CI_Session $session
 */
// class CI_Model {};
/* End of file autocomplete.php */
/* Location: ./application/config/autocomplete.php */

在控制器中,$this->db->where();被识别,命令单击将我带到该函数的源。但是,$query->num_row()在单击时会出现“找不到要转到的声明”错误。

在模型中,没有一个CI DB函数被识别。

EN

回答 2

Stack Overflow用户

发布于 2015-08-23 23:36:11

  1. https://gist.github.com/topdown/1697338下载gist文件
  2. 将其放在CodeIgniter项目的根目录中( index.php位于其中)。
  3. 在PhpStorm的Project面板中,转到(展开) system/core/
  4. 右键单击Controller.php并选择Mark as Plain Text
  5. Model.php也这样做

我正在使用PhpStorm 9,也许这会有所帮助。

票数 2
EN

Stack Overflow用户

发布于 2018-04-10 11:09:24

以下步骤非常简单:

  1. 创建phpstorm.php文件并将其放在CodeIgniter项目的根目录中。
  2. 在PhpStorm的Project面板中,转到(展开) system/core/。
  3. 右键单击Controller.php并选择标记为纯文本。
  4. 对于模型导航,对Model.php也做同样的操作。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32172196

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档