(抱歉我的英文寫作不好)。我遇到了一個問題,我被一個if和else系統卡住了,它返回了你的級別。If&Else stuck on return
一切都很好,如果你有20次點擊它會告訴你,你是第2級,如果你有550點擊它會告訴你是第6級。但是當你點擊1500點時,它需要說9平,但它仍然會說8級。
我的代碼:
$levelown = 'Level 1';
function ifElse() {
global $levelown;
global $arrayIP;
if($arrayIP['clicks'] >= 0 && $arrayIP['clicks'] <= 49)
{
$levelown = 'Level 2';
}
/* .... More if and elses with levels */
// This is the problem, this will keep telling me that I'm level 8.
elseif($arrayIP['clicks']>=3000)
{
$levelown = 'Level ' . floor(($score['clicks']/1000)+8);
}
and you are <strong><?php echo $levelown; ?></strong>
謝謝你的幫助!
您可以簡化它:擺脫所有'> ='測試。由於之前的測試是錯誤的,因此您知道該數字高於其範圍。 – Barmar
謝謝,我現在知道那個floor()部分一直告訴我我是8級的,但我不知道如何解決它。 – RezaM
適用於我:http://codepad.org/rJOnZndc – masterxilo