PHP Fatal error: Using $this when not in object context

后端 未结 9 2422
日久生厌
日久生厌 2020-11-22 03:48

I\'ve got a problem:

I\'m writing a new WebApp without a Framework.

In my index.php I\'m using: require_once(\'load.php\');

9条回答
  •  我寻月下人不归
    2020-11-22 04:08

    $foobar = new foobar; put the class foobar in $foobar, not the object. To get the object, you need to add parenthesis: $foobar = new foobar();

    Your error is simply that you call a method on a class, so there is no $this since $this only exists in objects.

提交回复
热议问题