{ "workbench.colorTheme": "Monokai", // 控制字型大小 (以像素為單位)。 "editor.fontSize": 18, // - 'bounded' (當檢視區縮至最小並設定 'editor.wordWrapColumn' 時換行). "editor.wordWrap": "on", // 控制編輯器是否應自動設定貼上的內容格式。格式器必須可供使用,而且格式器應該能夠設定文件中一個範圍的格式。 "editor.formatOnPaste": true, // 使用滑鼠滾輪並按住 Ctrl 時,縮放編輯器的字型 "editor.mouseWheelZoom": true, // 在儲存時設定檔案格式。格式器必須處於可用狀態、檔案不得自動儲存,且編輯器不得關機。 "editor.formatOnSave": true, // 控制已變更之檔案的自動儲存。接受的值: 'off'、'afterDelay、'onFocusChange' (編輯器失去焦點)、'onWindowChange' (視窗失去焦點)。若設為 'afterDelay',可以在 "files.autoSaveDelay" 中設定延遲。 "files.autoSave": "onFocusChange", "files.associations": { "*.tpl": "html" }, // 指向 PHP 可執行檔。 "php.validate.executablePath": "D:/UniServerZ/core/php71/php.exe", }
"phpfmt.php_bin": "D:/UniServerZ/core/php70/php.exe", "phpfmt.format_on_save": true, "phpfmt.indent_with_space": 4, "phpfmt.enable_auto_align": true, "phpfmt.visibility_order": true, "phpfmt.passes": [], "phpfmt.smart_linebreak_after_curly": true,
常用快捷鍵:
<?php $title = '尚無文章標題'; echo $title;
<?php
和
?>
的起始標記和結束標記符號中。?>
」符號$
開頭,中間不可有特殊符號,只能用底線,不可數字開頭,大小寫有別。=
是指派運算元,就是把右邊的值放入左邊的變數中。;
」結尾。echo
是PHP用來輸出資料的語言結構(不是函數),常用。!
,然後按
tab鍵
建立基礎HTML5頁面,請存成index.tpl。b4-$
,然後按
tab鍵
可建立含BootStrap4的基本頁面。<body>
中輸入
.container
,然後按
tab鍵
來產生BootStrap4的容器標籤。<form action="接收程式.php" method="傳送方式">表單</form>
action
屬性:用來指定使用者填好的東西,要送去給哪個程式來執行。method
屬性:指定傳送方法,可以是 POST(建議)或 GET(預設)enctype="multipart/form-data"
<?php require_once 'smarty/libs/Smarty.class.php'; $smarty = new Smarty; $title = '尚無文章標題'; $smarty->assign('title', $title); $smarty->display('index.tpl');
$smarty->assign('樣板標籤名稱', $變數值);
將變數送至樣板檔。<body>
中的內容:
<h2>{$title}</h2>
{$樣板標籤名稱}
<input type="格式" name="名稱" value="預設值" placeholder="佔位字元">
text
(文字框)、
hidden
(隱藏框)、
password
(密碼框)、
file
(上傳)name
最重要!一定要有!因為
name
送出後,會變成 PHP 的變數名稱。b4-form-group-text
快速產生一整組BootStrap4的文字輸入欄位<button type=”submit”>按鈕文字</button>
可做出按鈕效果<input type="radio" name="名稱" value="值 1">選項文字 1
<input>
,name 都要一樣才行! checked="checked"
<input type="checkbox" name="名稱[]" value="值 1">選項文字 1
<input>
[]
,如此會送出陣列。checked="checked"
<select name="名稱" size=1>選項</select>
<option value="值">選項文字</option>
selected="selected"
[]
外,還要加上
multiple
屬性。<textarea name="名稱">預設值</textarea>
<input type="text" name="title">
,表單送出後,方法若用post,那麼會得到
$_POST['title']
變數;若是用 get,那就是
$_GET['title']
if(條件){為真}else{為假}
來判斷變數是否存在。//
這是PHP單行註解,自己一行,或者放在程式後面都可以/*
這是PHP多行註解,中間可以有很多行
*/
<!--
這是 HTML 的註解,別搞混了
-->