// Get a single query result
public static function fetch($sql){
return $this->conn->query($sql)->fetch( PDO::FETCH_ASSOC);
}
Error:
Fatal error: Using $this when not in object context in D:\Web\api\Db.php on line 79
寻觅 beyond2018-03-07 11:42:21
Check it, it should be that there are a few more curly braces in front of this method, causing your fetch to be defined outside the class, so this situation occurs
辉2018-03-05 21:27:12
Fatal error, there is no such object in the $this context, view the content of the variable