Create such a model in the model and write the method to obtain the enumeration class.
Please do not pirated, reproduced please add source http://blog.csdn.net/yanlintao1
Class Student extends Zend_Db_Table {
Protected $ _ name = 'student ';
Protected $ _ primary = 'id ';
Function getPartyEnum ($ enumname ){
// Adapter and get data
$ Db = $ this-> getAdapter ();
$ Db-> query ("set names gbk ");
$ SQL = $ db-> quoteInto ('show COLUMNS FROM student LIKE? ', $ Enumname );
$ Res = $ db-> query ($ SQL)-> fetchAll ();
// Process the enumerated classes
// Obtain the enumerated string
$ Enum = $ res [0] ['type'];
// Previous (divided into two Arrays
$ Enum_arr = explode ("(", $ enum );
// Assign the second array to the variable. In fact, the first is an empty array.
$ Enum = $ enum_arr [1];
// The following (divided into two Arrays
$ Enum_arr = explode (")", $ enum );
// Assign the first array to the variable. In fact, the second is an empty array.
$ Enum = $ enum_arr [0];
// The comma-separated string is divided into N arrays.
$ Enum_arr = explode (',', $ enum );
// Empty the single quotes of each element
For ($ I = 0; $ I <count ($ enum_arr); $ I ++ ){
$ Enum_arr [$ I] = str_replace ("'", "", $ enum_arr [$ I]);
}
Return $ enum_arr;
}
}