//$shop_price = !empty($_POST['shop_price']) ? $_POST['shop_price']*0.9 : 0;
//$market_price = !empty($_POST['market_price']) ? $_POST['market_price'] : round($shop_price*$GLOBALS['_CFG']['market_price_rate']);
$zmm_tejia = explode(' ', $_POST[cn_goods_name]);
这些函数是什么意思?特别是$market_price = !empty($_POST['market_price']) ? $_POST['market_price'] : round($shop_price*$GLOBALS['_CFG']['market_price_rate']);
$market_price = !empty($_POST['market_price']) ? $_POST['market_price'] : round($shop_price*$GLOBALS['_CFG']['market_price_rate']);
这一句可以理解为
IF(($_POST['market_price'])!='') {//如果post传递的值不为空
$market_price =$_POST['market_price'];//那么变量market_price的值等于post传递过来的值
}Else{//如果post传递的值为空
$market_price =round($shop_price*$GLOBALS['_CFG']['market_price_rate'])//那么变量的值等于$shop_price*$GLOBALS['_CFG']['market_price_rate']这两个变量的值相乘,然后四舍五入取整.
}
$market_price = !empty($_POST['market_price']) ? $_POST['market_price'] : round($shop_price*$GLOBALS['_CFG']['market_price_rate']);
这是个赋值运算,右边是个三元运算符,先把三元运算符的值算出来之后才能赋值到左边,大致流程是检查$_POST['market_price']是否为空,如果不为空就把$_POST['market_price']值赋给$market_price,如果为空把round($shop_price*$GLOBALS['_CFG']['market_price_rate']) 得出来的值赋给$market_price