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] ]);
雖說 phalcon 的 mvc 架構已經很方便了,可是有些情況如果可以在 volt (view)處理的話會方便許多,比方要將回傳的資料表格某欄位做處理才顯示,典型的例子是將 integer 資料用 bit string 的方式顯示。
CSRF (cross site request forgery)特別對於表單的保護(尤其是登入頁面)很重要,在 Phalcon framework (3.x) 中可以參考以下範例(或者參考官方文件的 example)。
php 的陣列中移除一個元素後,如何把 index 重排(意即被移除的元素之後的所有元素的 index 往前移) unset($foo[5]); // remove item at index 5 $foo2 = array_values($foo); // ‘reindex’ array
php 內建的 mail() 是透過 local smtp, 但要走外面的 smtp server 的話, 可以用 PHPMailer 另外 HTML to Text 也有人家寫好的套件可以用 html2text
新舊版本的寫法差蠻多的,被舊的 phalcon devtools 自動產生的 model 給陰了..
最近踩到 apcu 的 deadlock 地雷,紀錄一下
可以用 fs 或者 shelljs 來做,各有千秋 //using fs fs = require(‘fs’); console.log((fs.readdirSync(‘../json/’)).length); //using shelljs shell = require(‘shelljs’); console.log((shell.ls(‘../json/’)).length);
在傳統的 asp 可以用 include 的方式,但在 asp.net 還是寫在 global.asax 或者用實作 IHttpModule 的方式來處理
主要重點在 1) 產生 postdata array 2) 檢查 response http status code 3) curl_options