###設定git環境
cd ~ #進入個人home目錄
ex./home/fish
vi .gitconfig
####編輯git環境檔,貼上以下環境設定變數
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = green
changed = red
In Phalcon Model system. 是根據ORM的架構,讓資料表物件化,讓在資料讀取或是寫入的動作上,可以利用物件的特性去操作。
初始設定
1 2 3 4 5 6 7 8 9 10 11
/** * Database connection is created based in the parameters defined in the configuration file */ $di->set('db', function() use ($config) { return new DbAdapter(array( 'host' => $config->database->host, 'username' => $config->database->username, 'password' => $config->database->password, 'dbname' => $config->database->dbname )); });
上列的動作會開啟與資料庫中間的連線關係,$config會去讀取所指定的設定文件
Model文件預設的命名方式為table名稱,例如:
1 2 3
class Rebots extends \Phalcon\Mvc\Model { }
官方文件建議,要在Model文件中描述資料表的欄位,以減少使用伺服器的記憶體資源。
如果Model的名稱與資料庫資料表名稱不同時,可以透過以下的方式重新設定所關聯的資料表名稱
1 2 3 4 5 6 7 8 9 10
public function initialize() { $this->setSource('Rebots'); } ```