php8 match

//  是否为套装 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('-出库商品方式异常')
// };
posted @ 2023-03-26 23:40  没事就更  阅读(21)  评论(0编辑  收藏  举报