happylee 发表于 2011-10-12 17:41:12

Zend Studio 8实现CodeIgniter代码提示的另一个方法

本帖最后由 happylee 于 2011-10-13 10:56 编辑

在CI_Controller和CI_Model的类定义前追加如下代码。
既能够进行代码提示,也能够在自定义Model中访问$this->db了。
/**
* @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 {
。。。
}



斯达客 发表于 2011-10-12 18:09:56

真的假的。我也试一下

斯达客 发表于 2011-10-12 18:13:27

不行。。把你的从0到成功的说一次感谢

happylee 发表于 2011-10-13 10:58:35

本帖最后由 happylee 于 2011-10-13 11:12 编辑

sorry, 注释代码里少了个”*“,修改了一下,你再试试看?
没有仔细研究过是zendstudio 8 for eclipse中的具体什么功能,导致了这个代码提示的成功。
目前我这里是ok的。

环境 : zendstudiofor eclipse ver 8.0.1

附上找到的phpdoc 中 @property这个注释的说明:

@property shows a "magic" property variable that is found inside the class.
datatype should be a valid PHP type or "mixed." phpDocumentor will display the optional description unmodified, and defaults to "mixed" if the datatype is not present.The property is presumed to be available for both read and write operations. If the property is read-only, you should use the @property-read tag instead. If the property is write-only, use @property-write.
补充说明:试一下按 ALT+/ 看看是否能够显示出提示?比如:输入$this->然后再按 ALT+/

kamengwang 发表于 2012-2-2 14:40:48

$this->db->get_where
只能提示到 db ,不能提示到 get_where 啊...
页: [1]
查看完整版本: Zend Studio 8实现CodeIgniter代码提示的另一个方法