用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4648|回复: 3
收起左侧

CI框架调用系统类库链接提示方法快捷选择

[复制链接]
发表于 2013-3-26 16:34:17 | 显示全部楼层 |阅读模式
本帖最后由 aqw23 于 2013-3-26 16:35 编辑

我们的控制器类主要是继承CI_Controller,因此只要在CI_Controller类的头部添加属性对应相关类即可。或许说的不明,请直接看代码。文件:system/core/Controller.php
@property为添加的属性说明代码。
调用实例如:$this->input->get();在IDE中当输入到input->时就会提示get等相关方法。
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package                CodeIgniter
* @author                ExpressionEngine Dev Team
* @copyright        Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license                http://codeigniter.com/user_guide/license.html
* @link                http://codeigniter.com
* @since                Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/**
* CodeIgniter Application Controller Class
*
* This class object is the super class that every library in
* CodeIgniter will be assigned to.
*
* @property CI_Loader            $load
* @property CI_DB_active_record  $db
* @property CI_Calendar          $calendar
* @property CI_Email             $email
* @property CI_Encrypt           $encrypt
* @property CI_Ftp               $ftp
* @property CI_Hooks             $hooks
* @property CI_Image_lib         $image_lib
* @property CI_Language          $language
* @property CI_Log               $log
* @property CI_Output            $output
* @property CI_Pagination        $pagination
* @property CI_Parser            $parser
* @property CI_Session           $session
* @property CI_Sha1              $sha1
* @property CI_Table             $table
* @property CI_Trackback         $trackback
* @property CI_Unit_test         $unit
* @property CI_Upload            $upload
* @property CI_URI               $uri
* @property CI_User_agent        $agent
* @property CI_Validation        $validation
* @property CI_Form_validation   $form_validation
* @property CI_Xmlrpc            $xmlrpc
* @property CI_Zip               $zip
* @property CI_Config            $config
* @property CI_Input             $input
* @property CI_Cache             $cache

* @package                CodeIgniter
* @subpackage        Libraries
* @category        Libraries
* @author                ExpressionEngine Dev Team
* @link                http://codeigniter.com/user_guide/general/controllers.html
*/
class CI_Controller {
..........省略...........

我们在调用自己model类方法也是一样的道理,如

1、我们写了一个test_model.php类(Test_model extends CI_Model)。
2、再写一个控制器test.php(Test extends CI_Controller)。
test.php代码:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* @property Test_model     $test_model
* @author LINK TEAM
*
*/
class Test extends CI_Controller {
        public function __construct()
        {
                parent::__construct();
                $this->load->model("test_model");
        }

        public function test()
        {
                $query = $this->test_model->getdata();//这里的方法在IDE中就会自动提示选择
        }
}





发表于 2013-3-26 23:23:50 | 显示全部楼层
我用的是geany,无效啊!你用的什么IDE啊,亲?
 楼主| 发表于 2013-3-27 12:38:47 | 显示全部楼层
Altair 发表于 2013-3-26 23:23
我用的是geany,无效啊!你用的什么IDE啊,亲?

eclipse,其它的我没测试过。
发表于 2013-3-31 17:47:40 | 显示全部楼层
我在eclipse测试过,不错,顶!!!

本版积分规则