switch(值){ 开始case 值: 闭合break; }
switch ($goods['leixing']) { case 1: $data['type'] = 1; $data['orderid'] = 'PT' . rand(000000, 999999) . time(); break; case 2: $data['type'] = 2; $data['orderid'] = 'WP' . rand(000000, 999999) . time(); break; case 3: $data['type'] = 3; $data['orderid'] = 'CT' . rand(000000, 999999) . time(); break; }