1銆佷粈涔堟槸濮旀墭妯″紡锛
閫氳繃鍒嗛厤鎴栧鎵樿嚦鍏朵粬瀵硅薄锛屽鎵樿璁℃ā寮忚兘澶熷幓闄ゆ牳蹇冨璞′腑鐨勫垽鍐冲拰澶嶆潅鐨勫姛鑳芥
2銆佸簲鐢ㄥ満鏅細
閾惰瀛樻锛屽彇娆撅紝杞处鎿嶄綔绫
3銆佸疄渚嬶細
/**
* 閾惰鐩稿叧鎿嶄綔绫
*/
class brank{
protected $Info=array();
/**
* 浼犲叆鍙傛暟锛岃缃熀鏈俊鎭
* @param string $type 绫诲瀷
* @param int $money 鍙傛暟鍊
* @return 濡傦細璁剧疆閾惰瀛樻绫诲瀷 updateBrankInfo('RMB','0.4%') // 绫诲瀷锛氫汉姘戝竵锛屽埄鐜囷細0.4%
*/
public function updateBrankInfo($type,$money){
$this->Info[$type]=$money;
}
/*
* 杩愯濮旀墭妯″紡
* @param string $branktype 鎿嶄綔绫诲瀷
* @param int $money 鎿嶄綔閲戦鏁
* @return class
*/
public function brankWithdraw($branktype){
$obj=new $branktype;
return $obj->brankMain($this->Info);
}
}
/**
* 閾惰瀛樻鎿嶄綔绫
*/
class brankDeposit{
public function brankMain($data){
return $data['brankDeposit'];
}
}
/**
* 閾惰鍙栨鎿嶄綔绫
*/
class brankWithdraw{
public function brankMain($data){
//$data['brankWithdraw'] //杩欎釜鍊兼槸鍦ㄥ疄渚嬪寲鍚庡氨璁剧疆濂界殑
return $data['brankWithdraw'];
}
}
/**
* 瀛樺彇娆惧鎵樿璁℃ā寮忕被
* -------------閫氳繃 brankWithdraw()鏂规硶 鍒嗛厤鎸囧畾鐨勬搷浣滅被瀵硅薄
* -------------閫氳繃 updateBrankInfo()鏂规硶 璁剧疆鐩稿叧鍙傛暟銆傚锛氬瓨鍙栨閲戦锛屽瓨鍙栨绫诲瀷锛屽埄鐜囩瓑绛
* @var unknown_type
*/
$brank=new brank();
$brank->updateBrankInfo('credit','绉垎鍚嶇О');
$brank->updateBrankInfo('brankDeposit', $money);//绫诲瀷锛氬瓨娆 閲戦锛$money
/////////////////////////////////////////////////////////////
$brankreturn=$brank->brankWithdraw('brankDeposit');//鎿嶄綔瀛樻绫
/////////////////////////////////////////////////////////////
$brankreturn=$brank->brankWithdraw('brankDeposit'); 鎿嶄綔鍙栨绫
浠ヤ笂灏辨槸PHP涔嬭璁℃ā寮忊斿鎵樻ā寮忕殑璇︾粏鍐呭锛屾洿澶氫俊鎭鍏虫敞OD浜戝叾瀹冪浉鍏虫枃绔狅紒