pdo封装数据库类的时候报了这样一条错误。

图片说明

说不是这个对象的成员函数,求大牛解惑

 <?php
header("Content-type:text/html;charset=utf8");
    class pdoMysql{
        public static $configAll = array();    //存储配置信息
        public static $link = null; //存储连接对象
        public static $pconnect = false;//在数据库连接的时候,第四个参数,是否开启长链接,默认为不开启
        public static $dbVersion = null;//存储数据库版本号
        public static $connect = false;//判断是否链接成功
        public static $pdoStmt = null;//存储PDO预处理对象
        public static $querySql = null;//query 保存最后一次执行操作

        public function __construct($config=""){
            if(!class_exists("PDO")){
                self::throw_error("不支持PDO,请先开启");
            }
            if(!is_array($config)){
                $config=array(
                    'hostname' => DB_HOST,
                    'username' => DB_USER,
                    'password' => DB_PASS,
                    'datebase' => DB_NAME,
                    'hostport' => DB_PORT,
                    'hosttype' => DB_TYPE,
                    'dsn' => DB_TYPE.":host=".DB_HOST.";dbname=".DB_NAME,
                );
            }

            /*判断主机名是否为空*/
            if(empty($config['hostname'])){self::throw_error('没有定义数据库的配置,请先定义');}
            self::$configAll = $config;
            /*数据库连接属性*/
            if(empty(self::$configAll['parm'])){self::$configAll['parm'] = array();}
            /*将数据库连接对象保存在$link中*/
            if(isset(self::$link)){
                $configs = self::$configAll;
                if(self::$pconnect){
                    //开启长连接
                    $configs['parm'][constant("PDO::ATTR_PERSISTENT")] = true;
                }

                try{
                    self:$link = new PDO($configs['dsn'],$configs['username'],$configs['password'],$configs['parm']);
                }catch(PDOException $e){
                    self::throw_error($e->getMessage());
                }

                if(!self::$link){
                    self::throw_error('PDO链接失败');
                    return false;
                }
                /*定义字符编码*/
                self::$link->exec("SET NAMES ".DB_CHARSET);
                /*定义数据库版本号*/
                self::$dbVersion = self::$link->getAttribute(constant("PDO::ATTR_SERVER_VERSION"));
                /*定义链接成功*/
                self::$connect = true;
                unset($configs);    
            }   
        }

        /*定义释放结果集*/
        public static function free(){
            self::$pdoStmt = null;
        }

        /*定义QUERY操作*/
        public static function query($sql=null){
            $link = self::$link;
            if(!$link) {return false;}
            //判断之前是否有结果集,如果有那么就先释放下结果集
            if(!empty(self::$pdoStmt)){self::free();}
            self::$querySql = $sql;
            //准备SQL语句
            self::$pdoStmt = $link->prepare(self::$querySql);
            $res = self::$pdoStmt->execute();
            //有错误的话执行下haveError()方法;没错误跳过此句
            self::haveError();
            return $res;
        }

        /*得到所有记录*/
        public static function selectAll($sql=null){
            if($sql != null){
                self::query($sql);
            }
            $result = self::$pdoStmt->fetchAll(constant("PDO::FETCH_ASSOC"));
            return $result;
        }

        /*错误提示*/
        public static function haveError(){
            $obj = empty(self::$pdoStmt)?self::$link: self::$pdoStmt;
            $arrObj = $obj->errorInfo();
            print_r($arrObj);
        }

        /*自定义异常信息*/
        public static function throw_error($errorMess){
            echo <<<EOF
                <div style="width:100%;height:150px;background:#000;color:#fff;">{$errorMess}</div>
EOF;
        }


    }
    require_once('config.php');
    $pdoMysql = new pdoMysql;
    // var_dump($pdoMysql);
    $sql = "SELECT * FROM text";
    print_r($pdoMysql->selectAll($sql));


?>