我对 PHP 相当陌生。我有一个检查价格成本的功能。我想从此函数返回变量以供全局使用:
<?
function getDeliveryPrice($qew){
if ($qew=="1"){
$deliveryPrice="60";
} else {
$deliveryPrice="20";
}
return $deliveryPrice;
}
// Assuming these two next lines are on external pages..
getDeliveryPrice(12);
echo $deliveryPrice; // It should return 20
?>