فهرست منبع

Eloquent数据操作类

visuddhinanda 4 سال پیش
والد
کامیت
ba59403a5d
1فایلهای تغییر یافته به همراه32 افزوده شده و 0 حذف شده
  1. 32 0
      app/db/database.php

+ 32 - 0
app/db/database.php

@@ -0,0 +1,32 @@
+// config/database.php
+
+// database connection file
+
+<?php
+class Database
+{
+    // specify your own database credentials
+    private $host = '127.0.0.1';
+    private $db_name = 'eloquent';
+    private $username = 'root';
+    private $password = 'password';
+	
+    public $conn;
+	
+	// public function __construct() {
+    // }
+	
+    public function EloquentConnection()
+    {
+        return [
+            'driver' => 'mysql',
+            'host' => $this->host,
+            'database' => $this->db_name,
+            'username' => $this->username,
+            'password' => $this->password,
+            'charset' => 'utf8',
+            'collation' => 'utf8_unicode_ci',
+            'prefix' => '',
+        ];
+    }
+}