Jump to content
sEnte

[Resolvido] unexpected 'private' (T_PRIVATE)

Recommended Posts

sEnte

<?php
class DB {
private static $_instance = null;
private $_pdo,
$_query,
$_error = false,
$_results,
$_count = 0;
}
private function __construct() {
try {
$this->_pdo = new PDO('mysql:host=' . Config::get('mysql/host') . ';dbname=' . Config::get('mysql/db') , Config::get('mysql/username'), Config::get('mysql/password'));
} catch (PDOException $e) {
die($e->getMessage());
}
}
public static function getInstance() {
if (!isset(self::$_instance)) {
self::$_instance = new DB();
}
return self::$_instance;
}
?>

Porque é que aparece este erro?

Edited by sEnte

"If It Ain't Broke, Break it and build something Cooler!" Unknown

Share this post


Link to post
Share on other sites
sEnte

Problema fácil de resolver.... a função __construct e o getInstance estão fora da class DB...


"If It Ain't Broke, Break it and build something Cooler!" Unknown

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.