通过目录ID来确认该目录是否有子目录

zen_has_category_subcategories($category_id)
该函数主要通过一个目录的ID来确认该目录是否有子目录,输入参数为目录ID值。如果存在子目录就返回TRUE,否则返回FALSE.
函数源代码: function zen_has_category_subcategories($category_id) { global $db; $child_category_query = "select count(*) as count from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$category_id . "'"; $child_category = $db->Execute($child_category_query); if ($child_category->fields['count'] > 0) { return true; } else { return false; } }