>mysql -u root -p
mysql> USE database;
mysql> GRANT ALL PRIVILEGES ON *.* TO user@localhost IDENTIFIED BY ‘password‘ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
>mysql -u root -p
mysql> USE database;
mysql> GRANT ALL PRIVILEGES ON *.* TO user@localhost IDENTIFIED BY ‘password‘ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
C:\Users\guest>nslookup
預設伺服器: google-public-dns-a.google.com
Address: 8.8.8.8
查詢MX
> set type=MX
> yahoo.com.tw
未經授權的回答:
yahoo.com.tw MX preference = 5, mail exchanger = mx1.mail.tw.yahoo.com
yahoo.com.tw MX preference = 5, mail exchanger = mx2.mail.tw.yahoo.com
yahoo.com.tw nameserver = ns1.yahoo.com
yahoo.com.tw nameserver = ns2.yahoo.com
yahoo.com.tw nameserver = ns3.yahoo.com
yahoo.com.tw nameserver = ns4.yahoo.com
yahoo.com.tw nameserver = ns5.yahoo.com
mx1.mail.tw.yahoo.com internet address = 203.188.197.9
mx2.mail.tw.yahoo.com internet address = 203.188.197.10
ns1.yahoo.com internet address = 68.180.131.16
ns2.yahoo.com internet address = 68.142.255.16
ns3.yahoo.com internet address = 217.12.4.104
ns4.yahoo.com internet address = 68.142.196.63
ns5.yahoo.com internet address = 119.160.247.124
查詢所有
> set type=any
> yahoo.com.tw
語法:FROM_UNIXTIME(unix_timestamp, format)
例子:SELECT FROM_UNIXTIME(1234567890, ‘%Y-%m-%d %H:%i:%S’)
big5 轉 utf-8
$str = iconv("big5″,"UTF-8″,$str);
utf-8 轉 big5
$str = iconv("UTF-8″,"big5″,$str);
►註解
{* 單行註解 *}
{*
多行註解
多行註解
*}
►引入樣版:
{include file=’header.tpl’}
{include file=’footer.tpl’}
$page = $smarty->fetch(‘index.tpl’);
►指派樣版變數
{assign var=’title’ value=’Smarty Templates’}
►foreach基本語法
{foreach from=$陣列變數 item=陣列元素名稱 key=陣列索引名稱 name=foreach名稱}
…
{foreachelse}
…
{foreach}
►日期格式
{$createDate|date_format:’%Y/%m/%d’}
►避免與Javascript衝突
{literal}
…
{/literal}
►列印陣列
{$arr|@print_r}
►讀取Request變數
{$smarty.get.page}
{$smarty.post.page}
{$smarty.cookies.status}
{$smarty.server.SERVER_NAME}
{$smarty.env.PATH}
{$smarty.session.id}
{$smarty.request.username}
<label id="myLabel" onClick="show();">Label標籤內容一</label><br />
<label id="myLabel" onClick="show();">Label標籤內容二</label><br />
<label id="myLabel" onClick="show();">Label標籤內容三</label>
<script type="text/javascript">
function show()
{
alert("label:" + myLabel[0].innerHTML);
alert("label:" + myLabel[1].innerHTML);
alert("label:" + myLabel[2].innerHTML);
}
</script>
$today = new DateTime();
$birthday = new DateTime("1980-01-01″);
$interval = $today->diff($birthday );
echo $interval->format("%y years, %m months, %a days, %h hours, %i minutes, %S seconds");
echo $interval->format("%y years");
echo $interval->format("Y-m-d");
echo $interval->days;
傳回自1970 /01/01 00:00:00 到現在相差秒數
time()
3 小時後的日期時間
date("Y-m-d h : i : s a", time() + 3 * 60 * 60);
取得指定日期時間的時間戳記
mktime(hour, minute, second, month, day, year)
設定時區
date_default_timezone_set("Asia/Taipei");