-1
當我使用$this
內create_function
我得到一個錯誤
Fatal error: Using $this when not in object context
create_function('$model, $this', 'return $this->di->getStatus($model->getStatus)');
後來我這樣稱呼它
$function($model, $this);
我通過$this
到該功能,但似乎並沒有工作。有辦法解決它嗎?
感謝
爲什麼downvoted?是合格的問題。我不會問是否可以找到方法。 – user2035693
我認爲人們假設(如你所不知道的那樣),你不知道$ this'只能用在類的上下文中。也許在你的問題中顯示函數確實存在於一個類中 – Martin