Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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();
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement