由於某種原因,我在For循環中出現錯誤。 我只想通過php中的數組向後走。PHP致命錯誤:For循環中不支持的操作數類型
瀏覽器中的錯誤是:
Fatal error: Unsupported operand types in /var/html/modules/getChat.php on line 18
線在此部分代碼1號線18:
這裏是代碼:
for($x = sizeof($result-1); $x > 0; $x--)
{
echo '<div class="message '.$result[$x].'"> <img src="'.$result[$x].'" /><span class="name">'.$result[$x].'</span>
<p>'.$result[$x].'</p>
</div>';
}
我希望你能幫助
Thanks Max
真的好像是'sizeof($ result) - 1'。 – raina77ow
非常感謝我用sizeof($ result)修復了它 - 1這也是一個愚蠢的錯誤 – Arayni