-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathStorage.php
More file actions
42 lines (31 loc) · 883 Bytes
/
Storage.php
File metadata and controls
42 lines (31 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Mohuishou\ImageOCR\Example;
use Medoo\Medoo;
class Storage{
private static $_instance = null;
private $_database;
private function __construct() {
$this->_database = new Medoo([
'database_type' => 'sqlite',
'database_file' => __DIR__ . '/db/db.db'
]);
}
private function clone(){
}
public static function getInstance(){
if(self::$_instance == null){
self::$_instance = new self();
}
return self::$_instance;
}
public function add($code,$hash){
$this->_database->insert("ocr",[
"code" => $code,
"hash" => implode("",$hash)
]);
}
public function get($code = null){
$arr = null && $code && $arr = ["code" => $code];
return $this->_database->select("ocr",["hash","code"]);
}
}