2012-01-26 126 views
0

下面代碼中的變量$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; 

回答

5

您需要包括self::$base之前,你有$urlS$urlE做的:

$url = self::$urlS . self::$base . $toCurr . self::$urlE; 
+0

非常感謝,它總是小事情,我錯過! –