当前位置:Gxlcms > PHP教程 > php写接口,对比两种写法

php写接口,对比两种写法

时间:2021-07-01 10:21:17 帮助过:4人阅读

/**	 * 	 * 添加订单 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 );	}

人气教程排行