Create a model in which you write a method that gets the enumeration class
Class Student extends zend_db_table{
protected $_name = ' student ';
Protected $_primary = ' id ';
function Getpartyenum ($enumname) {
Adapter and get the data
$db = $this->getadapter ();
$db->query ("SET NAMES GBK");
$sql = $db->quoteinto (' SHOW COLUMNS from student like ', $enumname);
$res = $db->query ($sql)->fetchall ();
Processing of the resulting enumeration class
Get the enumeration class string
$enum = $res [0] [' Type '];
With the preceding (divided into two arrays
$enum _arr = Explode ("(", $enum);
Assigns the second array to a variable, in fact the first is an empty array
$enum = $enum _arr [1];
In the back (divided into two arrays
$enum _arr = Explode (")", $enum);
Assigns the first array to a variable, in fact the second is an empty array
$enum = $enum _arr [0];
Dividing the resulting string into n arrays by a comma
$enum _arr = Explode (', ', $enum);
Turn single quotation marks for each element into empty
for ($i =0; $i <count ($enum _arr); $i + +) {
$enum _arr[$i] = str_replace ("'", "", $enum _arr[$i]);
}
return $enum _arr;
}
}