您好我目前的功能是這樣的......我想知道如何使用const apiKey
作爲數組。以及如何使用'key'=> self::apiKey
作爲'key'=> self::apiKey[rand(0,1)]
等。請幫助我。如何使用const數組而不是const變量?
const apiKey = 'api_key_ods000doo123';
public function counter_params($video_ID, $part) {
$params = array(
'id' => $video_ID,
'key' => self::apiKey,
'part' => $part
);
$result = self::Connect($params);
//print_r($params);
return $result;
}
所以定義常量爲陣列。 –
這是給錯誤.... –
然後發佈你的錯誤。如果不知道問題出在哪裏,我們不禁感慨。 – Bytewave