💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 通过商品ID的查询商品指定规格值&属性值的ID **位置:** Common\Common\function.php qjm 2022-03-28 **参数:** * @param int $goods_id spu_id/sku_id/item_id * @param int $attr_id 属性ID * @param int $goods_type 属性类型 1:唯一码 2:SPU 3:SKU **调用:** > PHP 调用: print_attr_id ($attr_id) > View 模版调用: {$vo['id']|print_attr_id} **完整代码:** ~~~ /** * 通过商品ID的查询商品指定规格值&属性值的ID * qjm 2022-03-28 * * @param int $goods_id spu_id/sku_id/item_id * @param int $attr_id 属性ID * @param int $goods_type 属性类型 1:唯一码 2:SPU 3:SKU * * @return int */ function print_attr_id ($goods_id, $attr_id, $goods_type) { $where = array ( 'goods_id' => $goods_id, 'attr_id' => $attr_id, 'goods_type' => $goods_type, 'is_delete' => 0 ); $result = M('goods_attr_relation')->where($where)->find(); return $result['id']; } ~~~