简体   繁体   English

Zend Studio 9.0.2中的CodeIgniter自动完成

[英]CodeIgniter auto complete in Zend Studio 9.0.2

Been trying to get Zend Studio to auto complete CodeIgniter. 一直试图让Zend Studio自动完成CodeIgniter。 Stumbled upon this stackoverflow answer though with no luck. 偶然发现了这个stackoverflow答案,但是没有运气。 I have added system/libraries to the PHP Include Path, though when I open a controller and try to get auto complete to work ($this->db) nothing appears. 我已经将系统/库添加到PHP包含路径,但是当我打开控制器并尝试使自动完成工作($ this-> db)时,什么都没有出现。

I've searched google for quiet a bit and the only answer I could find was the one I attached. 我已经在google上搜索了一下安静的内容,唯一能找到的答案就是我附上的答案。

If someone tried that before, maybe he could show me where I'm mistaken, Thanks in advance. 如果有人以前尝试过,也许他可以告诉我我错了哪里,谢谢。

One way to get the intellisense working is to create a dummy CI controller like - 使智能感知工作的一种方法是创建一个虚拟CI控制器,例如-

<?php
class CI_Controller {
/**
 *
 * @var CI_DB_active_record
 */
public $db;

/**
 *
 * @var CI_Loader
 */
public $load;

/**
 *
 * @var CI_Output
 */
public $output;

/**
 *
 * @var CI_Email
 */
public $email;

/**
 *
 * @var CI_Session
 */
public $session;

/**
 *
 * @var CI_Config
 */
public $config;

/**
 *
 * @var CI_Benchmark
 */
public $benchmark;

/**
 *
 * @var CI_Calendar
 */
public $calendar;

/**
 *
 * @var CI_Cart
 */
public $cart;

/**
 *
 * @var CI_Encrypt
 */
public $encrypt;

/**
 *
 * @var CI_Upload
 */
public $upload;

/**
 *
 * @var CI_Form_validation
 */
public $form_validation;

/**
 *
 * @var CI_FTP
 */
public $ftp;

/**
 *
 * @var CI_Table
 */
public $table;

/**
 *
 * @var CI_Image_lib
 */
public $image_lib;

/**
 *
 * @var CI_Input
 */
public $input;

/**
 *
 * @var CI_Language
 */
public $lang;

/**
 *
 * @var CI_Pagination
 */
public $pagination;

/**
 *
 * @var CI_Trackback
 */
public $trackback;

/**
 *
 * @var CI_Parser
 */
public $parser;

/**
 *
 * @var CI_Typography
 */
public $typography;

/**
 *
 * @var CI_Unit_test
 */
public $unit;

/**
 *
 * @var CI_URI
 */
public $uri;

/**
 *
 * @var CI_User_agent
 */
public $agent;

/**
 *
 * @var CI_Xmlrpcs
 */
public $xmlrpcs;

/**
 *
 * @var CI_Xmlrpc
 */
public $xmlrpc;

/**
 *
 * @var CI_Zip
 */
public $zip;

    }

Create another class to get instance of it - 创建另一个类以获取它的实例-

<?php
/**
* 
* Enter description here ...
* @return CI_Controller
*/
function get_instance()
{

}

Name them something like Dummy_CIController.php and Dummy_Factory.php and place them inside the /applications/libraries folder. 将它们命名为Dummy_CIController.php和Dummy_Factory.php,然后将它们放在/ applications / libraries文件夹中。

Since you are also going to need intellisense for models, create Dummy_CIModel.php that has everything which Dummy_CIController.php has except it extends CI_Model. 由于您还将需要智能感知模型,因此创建Dummy_CIModel.php,它具有Dummy_CIController.php具有的所有功能,除了它扩展了CI_Model。

You may later want to do some clean up by removing db intellisense from Controller as you wouldn't want to call database directly from the controller. 您稍后可能希望通过从Controller删除db intellisense进行一些清理,因为您不想直接从Controller调用数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM