NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
###通过规格属性的名称得到ID **位置:** Common\Lib\GoodsBaseLib.class.php **参数:** * @param $attr_name string 规格属性名称 * @return $attr_id int 规格属性的ID **调用:** * $goodsbase = new GoodsBaseLib(); * $attr_id = $goodsbase->getAttrId($$attr_name); **完整代码:** ~~~ /** * 通过规格属性的名称得到ID * whz 2018-05-15 * @param $attr_name string 规格属性名称 * @return $attr_id int 规格属性的ID */ public function getAttrId($attr_name) { $attr_id = M('goods_attribute') ->where("attr_name = '{$attr_name}' AND is_delete = '0'") ->getField('id'); return $attr_id; } ~~~