[PHP] 符號查詢大全 – PHP Symbol
引用至Stack Overflow: Reference – What does this symbol mean in PHP? What is this? This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is […]
網頁開發知識 | Web-Dev Blog
引用至Stack Overflow: Reference – What does this symbol mean in PHP? What is this? This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is […]
@ at 小老鼠 # hashtag/number 井字號 / slash 斜線 ~ tilde 波浪號 – hyphen 連字號 — dash 破折號 _ underline 底線 . dot 點 & ampersand/and 以及 * asterisk 星號/米字號 , comma 逗號 ’ apostrophe 撇號 : colon 冒號 ; […]
.tar | .gz | tar.gz | zip .tar (tar) Tape Archive 縮寫的未壓縮打包工具與其格式 打包 tar cvf OutputFile.tar.gz InputFile tar cvf OutputFile.tar.gz InputFile InputFile2 InputFile3 解包 tar xvf FileName.tar 查看tar內文件不解壓縮 tar -tvf FileName.tar 進入目標資料夾 (打包不含路徑) tar cvf OutputFile.tar.gz -C InputFileWithPath . tar […]
設定檔 這裡拿一個非Default的Site Host作範例。 添加80port的設定檔範例: server { listen 80; listen [::]:80; server_name code.yidas.com; return 301 https://$server_name$request_uri; } 至於原來的設定檔則由80改至443: #listen 80; #listen [::]:80; # SSL configuration # listen 443 ssl; listen [::]:443 ssl;
原生表單加入CSRF <form method=”post”> <input type=”hidden” name=”<?= Yii::$app->request->csrfParam; ?>” value=”<?= Yii::$app->request->csrfToken; ?>” /> <button type=”submit”> Save </button> </form>
情境 JavaScript如何達到靜態類別設計? https://github.com/yidas/js-design-patterns/blob/master/class/ Constructor Class var Class = function (options) { this.render = function () {} }; var object1 = new Class(); object1.render(); Literals Object JavaScript靜態物件的第一個想法, var Class = { render : function () {} }; Class.render(); 架構不錯,缺點為在物件內無法宣告區域變數(亦即達不到private變數或方法)。 若在物件方法中再次用到function,且須使用this指到物件本身就會有瓶頸,得每次帶入物件‵this‵本身,而無法從物件那層定義個物件區域變數代表this。 Static […]
使用情境 Windows要水平分割視窗竟然會如此困難即便到了Windows 10。 原生半調子解法 以Win10來說,工作列使用水平排列(Show windows stacked),可將現有視窗做水平排列,但相信我絕對不會是你要的。 使用AutoHotKey解法 首先認識AutoHotKey這套Open Source軟體,可以開啟.ahk檔案執行script。 軟體的基本使用可以參考:The Beginner’s Guide to Using an AutoHotkey Script 再來引用水平視窗切割(Vertical Windows Snapping)的Script,優化自:Snapping Windows Vertically on Portrait Display ; dir 0 = top part ; dir 1 = bottom part ; size […]
在linux系統中,如 freebsd,cron 排程的資料是存在/etc/crontab中,我們可以直接輸入 vi /etc/crontab進行編輯。 Linux Cron 指令 crontab -e 編輯排程 (edit cron) crontab -r 移除排程 (remove cron) crontab -l 顯示目前排程 (list cron)crontab -u 改變排程的執行身分: crontab -u user filename Cron 語法介紹 分鐘 小時 日 月 星期 執行身份 指令 0~59 0~23 1~31 (29,30) […]
使用情境 Javascript在匯出EXCEL有ASCII Code瓶頸不能完美支援,所以匯出CSV是較佳的選擇。 CSV匯出的亮點會在於Charset,例如支援中文而使用BOM。 技術亮點 var csvContent = “欄位A,欄位B\n值A,值B”; var link = window.document.createElement(“a”); link.setAttribute(“href”, “data:text/csv;charset=utf-8,%EF%BB%BF” + encodeURI(csvContent)); link.setAttribute(“download”, “upload_data.csv”); link.click(); 其中Link格式,使用UTF-8 with BOM: “data:text/csv;charset=utf-8,%EF%BB%BF” + encodeURI(csvContent) JSFiddle
情境 PHP SDK文件與範例Code目前版本就是有坑:例如Calendar PHP Google Client OAuth Token就是無法Refresh,調用Method出來就是NULL。 $client->getRefreshToken(); // Output = NULL 解決方法 設定Google_Client時ApprovalPrompt要設為Froce… $client->setApprovalPrompt(‘force’); 修正後的PHP SDK範例: $client = new Google_Client(); $client->setApplicationName(APPLICATION_NAME); $client->setScopes(SCOPES); $client->setAuthConfig(CLIENT_SECRET_PATH); $client->setAccessType(‘offline’); $client->setApprovalPrompt(‘force’); 可以參考2011年文章:Upcoming changes to OAuth 2.0 endpoint