php8 match

发布时间 2023-03-26 23:50:46作者: 没事就更
//  是否为套装 1是 2否
// match ($params['is_bundle']) {
// 1 => (function () use ($params) {
// if (!isset($params['bundles']) || empty($params['bundles'])) {
// throw new Exception('-套餐不能为空');
// }
// })(),
// 2 => (function () use ($params) {
// if (!isset($params['items']) || empty($params['items'])) {
// throw new Exception('-商品不能为空');
// }
// })(),
// default => throw new Exception('-出库商品方式异常')
// };