如何使用codeigniter让zend studio自动完成

2022-01-05 00:00:00 autocomplete php codeigniter zend-studio

我正在寻找一种很好的方法来为在 Zend Studio for Eclipse 中工作的 codeigniter 中的库获取自动完成和点击引用(不管它叫什么).

I'm looking for a good way to get autocomplete and click-for-reference (whatever that's called) for libraries in codeigniter working in Zend Studio for Eclipse.

例如,如果我这样做$this->load->library('dx_auth');$this->dx_auth->get_user_id();

for instance, if i do $this->load->library('dx_auth'); $this->dx_auth->get_user_id();

zend studio 不知道它是什么..

zend studio doesn't know what it is..

有一种很老套的方法(见下文,来源),但我觉得应该有更好的方法来做到这一点..

There is this sortof hacky way to do it (see below, source), but i feel like there should be a better way of doing it..

有人有什么想法吗?

// All of these are added so I get real auto complete
// I don't have to worry about it causing any problems with deployment
// as this file never gets called as I'm in PHP5 mode

// Core CI libraries
$config = new CI_Config();
$db = new CI_DB_active_record();
$email = new CI_Email();
$form_validation = new CI_Form_validation();
$input = new CI_Input();
$load = new CI_Loader();
$router = new CI_Router();
$session = new CI_Session();
$table = new CI_Table();
$unit = new CI_Unit_test();
$uri = new CI_URI();

推荐答案

添加 CI 的库路径作为项目的包含路径.

Add CI's library path as an include path to your project.

  1. 在PHP 资源管理器中,打开您的项目并右键单击包含路径
  2. 从上下文菜单中选择配置
  3. 然后在包含路径对话框中,选择库标签
  4. 点击添加外部文件夹...
  5. 浏览到 CI 的本地副本并选择它的库目录(保存这些类文件的任何位置)
  6. 点击完成
  1. In the PHP Explorer, open your project and right-click on Include Paths
  2. Select Configure from the context menu
  3. Then in the include path dialog, select the Library tab
  4. Click Add External Folder...
  5. Browse to a local copy of CI and choose it's library directory (wherever it keeps those class files)
  6. Click Done

瞧,你去吧!

我应该注意,您还可以在项目创建时定义包含路径.

I should note that you can also define include paths at the time of project creation.

相关文章