Last active
June 21, 2016 09:55
-
-
Save marsnow/a8610533c258eb96fa50bf3351cefa25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Database | |
| { | |
| private $servername; | |
| private $username; | |
| private $password; | |
| private $dbname; | |
| private $conn; | |
| private function connectDB() | |
| { | |
| for ($i = 0; $i < 3;++$i) { | |
| sleep(rand(1, 10) * $i); | |
| $conn = new mysqli($servername, $username, $password, $dbname); | |
| if ($conn->connect_errno) { | |
| errLog('MySQL 連線失敗第 '.($i + 1)." 次:: (錯誤代碼: $conn->connect_errno) $conn->connect_error"); | |
| } | |
| } | |
| return $conn; | |
| } | |
| public function setMysqli($servername, $username, $password, $dbname) | |
| { | |
| $this->servername = $servername; | |
| $this->username = $username; | |
| $this->password = $password; | |
| $this->dbName = $dbname; | |
| } | |
| public function getConnection() | |
| { | |
| return $this->connectDB(); | |
| } | |
| } | |
| class PhotoQuery | |
| { | |
| private $photoSource; | |
| private $minx; | |
| private $miny; | |
| private $maxx; | |
| private $maxy; | |
| private function getPhotos() | |
| { | |
| } | |
| public function setPhotoSource($source) | |
| { | |
| } | |
| public function setCoordinate($minx, $miny, $maxx, $maxy) | |
| { | |
| $this->minx = $minx; | |
| } | |
| } | |
| class Log | |
| { | |
| private $location; | |
| public $messages; | |
| private function saveLog() | |
| { | |
| } | |
| public function setLog($message) | |
| { | |
| } | |
| } | |
| Database->setMysqli('localhost', 'root','0000','larvata_travel'); | |
| PhotoQuery->setPhotoSource('panoramio'); | |
| PhotoQuery->setCoordinate('120','20','122','25'); | |
| PhotoQuery->save(); | |
| Database->close(); | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment