Add parameters while dispatcher forwarding in phalcon
$this->dispatcher->forward([ ‘controller’ => “Keyproduct”, ‘action’ => ‘edit’, ‘params’ => [$keyproduct->keyhash] ]);
$this->dispatcher->forward([ ‘controller’ => “Keyproduct”, ‘action’ => ‘edit’, ‘params’ => [$keyproduct->keyhash] ]);
做 merge 的時候難免手殘… <!–more–> 如果還沒 push 到 server 上,那可以用 git reset –hard HEAD~1 來復原。如果是用 –soft 的話該 merge commit 依然會存在 local repository中,不像用 –hard 會刪除。 $ git log commit f92ab34564f48ad6ee9f6bdb13c352e63669dccd Merge: 62f6af0 4f641f3 Author: admin <admin@test.com> Date: Fri Jun 23 11:07:53 2017 +0800 before merge 3d_checkpoint commit 62f6af03b7dc1f0539836b13910850189a0fcd2a Author: admin <admin@test.com> Date: Thu Apr 20 11:54:58 2017 […]
雖說 phalcon 的 mvc 架構已經很方便了,可是有些情況如果可以在 volt (view)處理的話會方便許多,比方要將回傳的資料表格某欄位做處理才顯示,典型的例子是將 integer 資料用 bit string 的方式顯示。
CSRF (cross site request forgery)特別對於表單的保護(尤其是登入頁面)很重要,在 Phalcon framework (3.x) 中可以參考以下範例(或者參考官方文件的 example)。
起因是因為 iOS 上 safari 瀏覽器在做 ajax request 的時候,有時會有bug (https://stackoverflow.com/questions/33895463/safari-ajax-request-failed-to-load-resource-the-network-connection-was-lost),有個解法是把網頁伺服器的 keep-alive 關閉 reference: https://manage.togglebox.com/index.php?/knowledgebase/article/20/turn-off-keepalive-to-reduce-apache-ram-usage/ https://svennd.be/keepalive-on-or-off-apache-tuning/
今天遇到的狀況是,不小心把 local branch detach, 而且原本的 local branch 整個被改爛,然後要把修改過的東西(detached HEAD) push 回 remote branch,並把爛掉的 local branch track 上正確的 remote branch
php 內建的 mail() 是透過 local smtp, 但要走外面的 smtp server 的話, 可以用 PHPMailer 另外 HTML to Text 也有人家寫好的套件可以用 html2text
新舊版本的寫法差蠻多的,被舊的 phalcon devtools 自動產生的 model 給陰了..
紀錄一下,要不然每次都還要找 +__+ 用 %{ms}T $ more /etc/apache2/apache.conf …. LogFormat “%v:%p %h %l %u %t \”%r\” %>s %O %{ms}T \”%{Referer}i\” \”%{User-Agent}i\”” vhost_combined LogFormat “%h %l %u %t \”%r\” %>s %O %{ms}T \”%{Referer}i\” \”%{User-Agent}i\”” combined 官方文件: https://httpd.apache.org/docs/current/mod/mod_log_config.html
其實就是同事弄錯的事情經過 起因是同事想把Branch A倒退回前先前的 commit (rollback),下命令要直接對remote上的 branch 改指到某個 commit 上,但是因為工時太長(x)恍神(o)下錯命令… #當下在3d_new這個branch上,要rollback一個commit,所以理論上要這樣 ~/testGit/gittest$ git push –force origin HEAD^:3d_new #但是下錯命令變成改到3d_test去 ~/testGit/gittest$ git push –force origin HEAD^:3d_test Total 0 (delta 0), reused 0 (delta 0) To git@git_url:group_name/gittest.git + 62f6af0…36b6b05 HEAD^ -> 3d_test (forced update) 這樣的結果變成 3d_test 的 HEAD 被定到 3d_new 的 HEAD^ 去,如果這時候比較 local 與 remote repository 會發現,local上3d_test的commit從與 3d_new […]