示例#1
0
 public static function getInstance()
 {
     if (self::$single instanceof self) {
         return self::$single;
     } else {
         return self::$single = new self();
     }
 }
示例#2
0
    public function insert($table_name, $data = array())
    {
        //获取要更新的key
        $columns = $this->array_to_string(array_keys($data), false);
        $values = $this->array_to_string(array_values($data), true);
    }
    //将数组组合成字符串,
    public function array_to_string($data = array(), $type = false)
    {
        if ($type == false) {
            foreach ($data as &$key) {
                $key = '`' . $key . '`';
            }
        } else {
            foreach ($data as &$key) {
                $key = "" . $key . "";
            }
        }
        return $data;
    }
    //防止对象被克隆
    public function __clone()
    {
        trigger_error("your can't clone this object");
    }
}
/**
 * 测试代码
 */
$test = single::getinstance();