以下代码中的$base
变量显然超出了范围,但$urlS
和$urlE
变量不是?有人可以解释为什么会这样吗?
class Yahoo {
//Code below to retrieve live currency rates from yahoo
private static $base = 'USD';
private static $urlS = LIVE_FEED_YAHOO;
private static $urlE = '=X&f=l1';
private $rate;
public function __construct($toCurr) {
$url = self::$urlS.$base.$toCurr.self::$urlE;
答案 0 :(得分:5)
您需要在self::
之前加入$base
,就像使用$urlS
和$urlE
一样:
$url = self::$urlS . self::$base . $toCurr . self::$urlE;