Archive

‘PHP技巧’ 分類過的Archive

[備忘]在PHP中強制傳送big5編碼給jquery xhr解讀

2010年7月8日 imusm 尚無評論

今天幫一支舊程式改成使用的方式去request 一個網頁,因為網站是之前寫的還沿用big5編碼!

使得在傳送資料時解讀成亂碼!
閱讀全文…

Popularity: 4% [?]

  • Share/Bookmark

相關文章

[備忘]php 回傳 jquery json datatype

2010年7月1日 imusm 尚無評論

1.3.2(含)之前的版本,若使用PHP 回傳Json型態的資料,可以使用字串組合成json資料的型式!
也能接受它,並加以使用!

在剛剛嚐試後,發現jquery1.4.2版後,已不能接受這樣的用法!
若PHP 要回傳json型態的資料,一定得用json_endcode 去產生正確的格式!

可能一些同好或前輩們都知道了吧!

我想以後不能偷懶不用json_encode了!

Popularity: 4% [?]

  • Share/Bookmark

相關文章

PHP MSSQL Driver UTF8 讀取及寫入資料

2009年9月7日 imusm 尚無評論

其實這些語法,在下載回來的套件中都有說明檔解釋的很清楚!但..有時候自己用起來就不是那麼順利!
以下是我自己試出來的部份,用來寫入中文並讀取出來是沒有問題的!
有需要的朋友請參考!
閱讀全文…

Popularity: 13% [?]

  • Share/Bookmark

相關文章

MS SQL PHP Driver 1.1版的 Native Client Driver給錯了!

2009年8月25日 imusm 尚無評論

在windows 7 中測試了一下1.1版,發現一直跟我說,我沒有裝SQL Server Native Client版!
畫面上一直給我錯誤的訊息,並導引我去下載!誰知道這個訊息導引所下載的版本也是錯的!
還好在MSDN上也看到有人有相同的問題!

找了一下正確的版本提供同好下載!

X86 Package (sqlncli.msi) – 4504 KB
X64 Package (sqlncli.msi) – 7919 KB
IA64 Package (sqlncli.msi) – 11078 KB

在這個版本中的 MS SQL  PHP DRIVER中,已提供了對UTF-8的支援!而且可以正確的使用哦!
詳情請看下篇囉!

For English
There is a erron message from the origanal Ms Sql PHP Driver1.1 who tell u don’t have the Microsoft Sql Server Native Client! And it will lead u to downlad a wrong version driver!
Here is the correct version to download!!

X86 Package (sqlncli.msi) – 4504 KB
X64 Package (sqlncli.msi) – 7919 KB
IA64 Package (sqlncli.msi) – 11078 KB

Hope this message will help !

Popularity: 10% [?]

  • Share/Bookmark

相關文章

加裝wp-syntax,使用方式如下

2008年4月17日 imusm 尚無評論

Example 1: PHP, no line numbers

在原始碼模式下,使用下列語法
<div id="foo">
< ?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>
<div id="foo">
< ?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>

閱讀全文…

Popularity: 18% [?]

  • Share/Bookmark

相關文章

PHP中文擷取字串

2007年9月5日 imusm 1 則評論

只要PHP.INI檔裡,有使用mbstring的擴充功能!便可使用mb_substr()的函式

用法如下:
mb_substr(字串,啟始位置,擷取字數,編碼)
例:mb_substr("擷取字串",0,2,’big5′
可得=>"擷取"二字

官方說明連結:http://tw.php.net/manual/tw/function.mb-substr.php

希望可以幫助大家

Popularity: 24% [?]

  • Share/Bookmark

相關文章

Categories: PHP技巧 Tags:

使用cal_days_in_month取得當月最後一天

2007年8月3日 imusm 尚無評論

可以使用這個函數cal_days_in_month(CAL_GREGORIAN, 月份,年份)取得所需月份的最後一天
例:

cal_days_in_month(CAL_GREGORIAN, 8,2007)

會取得31

Popularity: 11% [?]

  • Share/Bookmark

相關文章

Categories: PHP技巧 Tags: