CI框架調用系統類庫鏈接提示方法快捷選擇

我們的控制器類主要是繼承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中就會自動提示選擇
        }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章