php写接口,对比两种写法
/** * * 添加订单 1年之前我写的 * @param String $sno * @param String $name 订单名称 * @param int $uid * @param String $realname * @param String $shr * @param String $address * @param String $mobile * @param String $num * @param decimal $coupons * @param decimal $money * @param String $remark */ public function addOrder($sno, $name, $uid, $realname, $shr, $address, $mobile, $num, $coupons, $money, $remark, $status) { $params = array (‘uid‘ => $uid, ‘name‘ => $name, ‘orderno‘ => $sno, ‘shr‘ => $shr, ‘address‘ => $address, ‘mobile‘ => $mobile, ‘addtime‘ => time (), ‘remark‘ => $remark, ‘num‘ => $num, ‘money‘ => $money, ‘coupons‘ => $coupons, ‘status‘ => $status ); return OrderModel::instance ()->addOrder ( $params ); } /** * 增加订单接口 改进后 * * @param int $uid * @param Array $order name|orderno|count|coupons|status * @param String $remark */ public function addOrderAPI($uid, $order, $remark) { $params = array (‘uid‘ => $uid, ‘name‘ => $order[‘name‘], ‘orderno‘ => $order[‘orderno‘], ‘addtime‘ => time (), ‘remark‘ => $remark, ‘num‘ => $order[‘count‘], ‘coupons‘ => $order[‘coupons‘], ‘status‘ => $order[‘status‘] ); return OrderModel::instance ()->addOrder ( $params ); }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。