參考網址:
du -sh *
參考網址:Tom Ordonez Create a Regex Macro in Sublime
sport.sql.php 誀個檔案中放著sql建立資料表的語法,因為有許多資料表,要找到想要的資料表常常得翻來翻去,著實麻煩。
想說如果有個類似UltraEdit的function列表就方便找尋了,於是試著做做看。
#function aa_game_date {
#
# 資料表格式: `game_date`
#
DROP TABLE IF EXISTS game_date;
CREATE TABLE game_date (
game_date_id tinyint(4) NOT NULL auto_increment,
#主索引鍵
game_date_str char(4) NOT NULL default '0',
#比賽日期
PRIMARY KEY (game_date_id)
)ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 ;
#
# 列出以下資料庫的數據: `game_date`
#
INSERT INTO game_date VALUES (1, '0105');
INSERT INTO game_date VALUES (2, '0106');
INSERT INTO game_date VALUES (3, '0107');
INSERT INTO game_date VALUES (4, '0108');
#INSERT INTO game_date VALUES (5, '0205');
#}
一開始糸嘗試用macro來做,發現macro無法記錄find 及 replace。
首先安裝symlist這個外掛,再來安裝regReplace外掛
Go to the top menu Preferences/Package Settings/RegReplace/Rules-User.
{
"format": "3.0",
"replacements": {
// function 變成function模式
"func_start": {
"find": "^#function",
"replace": "function",
"greedy": true
},
"func_end": {
"find": "^#}",
"replace": "}",
"greedy": true
},
"func_top": {
"find": "^#####top",
"replace": "<?php",
"greedy": true
},
"func_bottom": {
"find": "^#####bottom",
"replace": "?>",
"greedy": true
},
// unfunction 變成註解模式
"unfunc_start": {
"find": "^function",
"replace": "#function",
"greedy": true
},
"unfunc_end": {
"find": "^}",
"replace": "#}",
"greedy": true
},
"unfunc_top": {
"find": "^<\\?php",
"replace": "#####top",
"greedy": true
},
"unfunc_bottom": {
"find": "^\\?>",
"replace": "#####bottom",
"greedy": true
}
}
}
問號得加兩條\
Go to the top menu Preferences/Package Settings/RegReplace/Rules-User.
[
{
"caption": "RegReplace: function",
"command": "reg_replace",
"args": {"replacements": ["func_start","func_end","func_top","func_bottom"]}
},
{
"caption": "RegReplace: unfunction",
"command": "reg_replace",
"args": {"replacements": ["unfunc_start","unfunc_end","unfunc_top","unfunc_bottom"]}
}
]
建立快捷鍵
Preferences/Key Buiding/user
[
{
"keys": ["ctrl+alt+f"],
"command": "reg_replace",
"args": {"replacements": ["func_start","func_end","func_top","func_bottom"]}
},
{
"keys": ["ctrl+alt+u"],
"command": "reg_replace",
"args": {"replacements": ["unfunc_start","unfunc_end","unfunc_top","unfunc_bottom"]}
}
]
原來不用這麼麻煩,outline外掛原本就內建sql模式,把語言改成sql,它就會自動抓'CREATE TABLE' 當大綱。
https://github.com/warmdev/SublimeOutline/issues/22
用ctrl+shift+p叫出Command Palette
輸入outline可以找到
Outline :Toggle Sort 切換list排序方式
Browse Mode:Outline(Left)
Browse Mode:Outline(Right) list表放在右邊
參考網址:ItRead01
按下快捷鍵 Ctrl+Shift+P 調出命令板,在出現的文字框中輸入 Install Package(
或直接 輸入“ip”)選中 Install Package 並回車,輸入 ColorPicker再按 Enter(回
車)等待安裝完成
預設快捷鍵是ctrl+shift+c但容易衝突
Preferences->BrowsePackages進入外掛的資料夾
找到相應外掛目錄進入找到Default (Windows).sublime-keymap檔案修改其中內容即可,要修改成不易衝突的快捷鍵哦
目前設為 ctrl+alt+c
從tools也可以找到進入ColorPicker的選項
參考網址:痞客邦
SQL指令–mySQL 檢查欄位是否存在 (MySQL–check which column exists in table)
SELECT count(*) FROM information_schema.columns WHERE table_schema='<Database Name>' AND table_name = '<Table Name>' AND column_name = '<Column Name>'
results as below:
0 if the <Column Name> doesn't exist;
1 otherwise.
參考網址:symList symList – clickable function list for Sublime Text
symlist.py (Python source, 7kb)
Download „symlist.py“ and copy the file to the Preferences / Browse Packages / „User“ directory.
For better handling, add a keyboard shortcut like
{ "keys": ["ctrl+alt+s"], "command": "symlist" }
to your personal key bindings.
還有一個外掛也有這樣的功能 outline
https://packagecontrol.io/packages/Outline
參考網址:程式前沿
try{
$pdo=new PDO('mysql:host=localhost;dbname=alpha','root','password');
}catch(PDOException $e){
echo "資料庫連線失敗,原因是:".$e->getMessage();
}
//從資料庫中選擇資料,並將結果賦予一個變數,testtable為資料庫表
$result=$pdo->query('select id,name,age from testtable');
//將查詢出的資料輸出
while($row=$result->fetch()){
echo "ID:".$row['id'];
echo "NAME:".$row['name'];
echo "AGE:".$row['age'];
}
參考網址:
閃鈴教室 https://sites.google.com/view/shinydiaboloclassroom
閃鈴教室fb https://www.facebook.com/ShinyDiaboloClassroom
民俗體育教學資源網 https://custom.nutn.edu.tw/
109學年度全國民俗體育競賽 https://custom.nutn.edu.tw/contest/?q=47
參考網址:程式前沿 PHP中error_reporting()用法詳解
建議使用
error_reporting(7);
只顯示嚴重錯誤,有Fatal error:時也會顯示
ini_set('display_errors',1);
ini_set("error_reporting",7);
//ini_set("error_reporting", E_ALL & ~E_NOTICE );
//E_ALL & ~E_NOTICE 可顯示 Fatal error:
//要注意 E_ALL & ~E_NOTICE 不可用" "
// E_ALL E_NOTICE 等是php定義的常數,不可用" 包起來
//ini_set("error_reporting", E_ERROR | E_WARNING | E_PARSE );
//error_reporting( E_ERROR | E_WARNING | E_PARSE );
1 E_ERROR 致命的執行時錯誤
2 E_WARNING 執行時警告(非致命性錯誤)
4 E_PARSE 編譯時解析錯誤
8 E_NOTICE 執行時提醒(經常是bug,也可能是有意的)
16 E_CORE_ERROR PHP啟動時初始化過程中的致命錯誤
32 E_CORE_WARNING PHP啟動時初始化過程中的警告(非致命性錯)
64 E_COMPILE_ERROR 編譯時致命性錯
128 E_COMPILE_WARNING 編譯時警告(非致命性錯)
256 E_USER_ERROR 使用者自定義的致命錯誤
512 E_USER_WARNING 使用者自定義的警告(非致命性錯誤)
1024 E_USER_NOTICE 使用者自定義的提醒(經常是bug,也可能是有意的)
2048 E_STRICT 編碼標準化警告(建議如何修改以向前相容)(此错误级别未使用,且自 PHP 8.4.0 起已弃用。)
4096 E_RECOVERABLE_ERROR 接近致命的執行時錯誤,若未被捕獲則視同E_ERROR
6143 E_ALL 除E_STRICT外的所有錯誤(PHP6中為8191,即包含所有)
32767 E_ALL
最近改寫程式以適應PHP8
似乎還有 E_DEPRECATED 常量值:8192
https://www.php.net/manual/zh/errorfunc.constants.php
參考網址:iT邦幫忙 MySQL: 子查詢
select gov_code,count(player_id) as cc from (select gov_code,player_id from game group by player_id) abc group by gov_code
player可以參加多項比賽。()內的子查詢先把 player_id group 起來變成只有一筆資料,記得()之後便給個名字,讓它變成一個table。