PHP big5轉utf8不要用iconv(),iconv這個函數,用mb_convert_encoding

不要以為big5轉utf8就用iconv()這麼簡單

big5有很多字是沒有收錄的:

測試:

用法:

原文出自:

http://sweslo17.blogspot.tw/2012/04/big5-erpms-sql-local-cache-phpiconv.htmlhttp://dev.sopili.net/2009/08/phpbig5utf8iconv.htmlhttp://help.i2yes.com/?q=node/65

[……]

閱讀更多

CSS em標籤失效 em,strong,em tag not working

我們習慣在CSS編寫前引入reset.css來重設所有標籤的預設樣式,
但引入reset.css後,透過編輯器如CKEditor,可能產生斜體<em>標籤,
此時<em>標籤便失去原本html應該會呈現的斜體,另外粗體<b>..等,也會有此現象,
解決方法在引入reset.css後加入下面兩行CSS,問題解決
strong, b, strong *, b * { font-weight: bold !important; }
em
, i, em *, i * { font-style: italic !important; }

[……]

閱讀更多

CSS 項目符號

list-style-type:none; 《不編號》
list-style-type:decimal; 《阿拉伯數字》
list-style-type:lower-roman; 《小寫羅馬數字》
list-style-type:upper-roman; 《大寫羅馬數字》
list-style-type:lower-alpha; 《小寫英文字母》
list-style-type:upper-alpha; 《大寫英文字母》
list-style-type:disc; 《實心圓形符號》
list-style-type:circle; 《空心圓形符號》
list-style-type:square; 《實心方形符號》
list-style-image:url(dot.gif); 《圖片式符號》
list-style-position:outside; 《凸排》
list-style-position:inside; 《縮排》

原文出處
http://stenlyho.blogspot.tw/2008/07/css.html

[……]

閱讀更多

PHP 數字字串取奇數或偶數, 奇數/偶數如何判斷

奇數及偶數判斷我想應該很多方法
我這邊提供一種方法判斷
就是數值除2取餘數的方式

//偶數餘0
2/2 餘 0
4/2 餘 0
6/2 餘 0

//奇數餘1
1/2 餘 1
3/2 餘 1
5/2 餘 1

運算子

在PHP裡取餘數的運算子為 %
echo 6%2 ;  //結果 0

應用

//數字字串轉數字陣列
$str_arr = str_split(‘14063070084’);

//取奇數
foreach($str_arr as $k=>$v){
if(!($k%2))echo $v;
}

//取偶數
foreach($str_arr as $k=>$v){
if($k%2)echo $v;
}[……]

閱讀更多

CSS 直式文字中英文編排 相容 IE 及 Chrome

writing-mode: tb-rl;
-ms-writing-mode: tb-lr;
-webkit-writing-mode: vertical-lr;
-moz-writing-mode: vertical-lr;
-ms-writing-mode: vertical-lr;
writing-mode: vertical-lr;

延申閱讀
http://generatedcontent.org/post/45384206019/writing-modes[……]

閱讀更多

php .htaccess 實用範例

關閉 magic_quotes_gpc

# Only if you use PHP
<ifmodule mod_php4.c>
php_flag magic_quotes_gpc off
</ifmodule>

減少 Bandwidth 使用量

# Only if you use PHP
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>

變更 scripts 副檔名

AddType application/x-httpd-php .php4

以上語句會將 .php4 當成 PHP 程式編譯。

禁止 .htaccess 開放瀏覽

<files file-name>
order allow,deny
deny from all
</files>

變更預設頁面

DirectoryIndex myhome.htm index.htm index.php

自訂錯誤頁面

ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html

開放/禁止瀏覽目錄

# 禁止
Options All -Indexes
# 開啟
Options +Indexes

本文出自
http://www.hkcode.com/linux-bsd-notes/438

Apache Rewrite with Htaccess 理解與技巧

[……]

閱讀更多