虽然关于如何让PhpStorm识别CodeIgniter 2.x核心函数有很多答案,但我不知道如何让它识别CodeIgniter 3.0数据库函数。
我的配置目录中有一个autocomplete.php文件,它非常适合CodeIgniter 2.x (以及大多数版本3.0)。由于v3删除了活动记录类,因此不再识别DB函数。
// help IDE(s) support Codeigniter 2.0
* @property CI_DB_active_record $db <-- no longer valid.
...
*/如何使PhpStorm自动完成与新的CI v3 DB类一起工作?
更新:这是我的autocomplete.php文件:
<?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函数被识别。
发布于 2015-08-23 23:36:11
index.php位于其中)。system/core/Controller.php并选择Mark as Plain TextModel.php也这样做我正在使用PhpStorm 9,也许这会有所帮助。
发布于 2018-04-10 11:09:24
以下步骤非常简单:
https://stackoverflow.com/questions/32172196
复制相似问题