0
推入數組中的對象屬性的正確方法是什麼?推入屬於對象屬性的數組的正確方法是什麼?
錯誤:
Fatal error: Cannot use [] for reading in ... on line ..
代碼:
class StreamResponse
{
public $messages ;
function __construct($post)
{
$strippost = stripslashes_deep($_POST);
foreach ($strippost['messages'] as $message)
{
$m = json_decode($message, true);
$this->$messages[] = $m; //<-- This line is the line with the issue
}
}
}