我在控制器中創建了一個公共靜態函數,我需要訪問在構造函數中設置的類屬性。我通常使用$this->something
訪問這些類的屬性,但是這一次,我得到這個錯誤:
Using
$this
when not in object context
下面的代碼:
public static function PayExecute() {
$paymentId = Input::get('paymentId');
$PayerID = Input::get('PayerID');
$cont = $this->apiContext;
}
你不能在靜態函數中使用$ this –