在CI_Controller和CI_Model的类定义前追加如下代码。
既能够进行代码提示,也能够在自定义Model中访问$this->db了。
PHP
/**
* @property CI_Loader $load
* @property CI_DB_active_record $db
* @property CI_Calendar $calendar
* @property 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_Xmlrpc $xmlrpc
* @property CI_Zip $zip
*/
class CI_Model {
。。。
}
既能够进行代码提示,也能够在自定义Model中访问$this->db了。
PHP
/**
* @property CI_Loader $load
* @property CI_DB_active_record $db
* @property CI_Calendar $calendar
* @property 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_Xmlrpc $xmlrpc
* @property CI_Zip $zip
*/
class CI_Model {
。。。
}
来源:oschina
链接:https://my.oschina.net/u/726090/blog/172401