Archive
使用PHP從Gmail發信
參考自deepakssn : Send email using PHP with Gmail
1. 首先下載 PHPMailer ( http://phpmailer.sourceforge.net )
2. 解壓縮至 phpmailer 資料夾 (自己找的到就好)
3. 新建一個 PHP ( ex: email.php)
4. 修改email.php
Read more…
[PHP] number_format
當你計算依些數值的時候,有些時候會想要取到小數點第二位之類的
就可以使用number_format囉! 之前我都是使用printf(“%.2f”,$num);
最近發現 number_format 也很好用喔!!
而且還可以設定自己想要的格式,如果我要取到小數點第二位的話
number_format($num,2);
其他相關用法: $number = 1234.56; // 預設 // French notation $number = 1234.5678; // english notation without thousands seperator ?>
$english_format_number = number_format($number);
// 印出 1,235
$nombre_format_francais = number_format($number, 2, ',', ' ');
// 1 234,56
$english_format_number = number_format($number, 2, '.', '');
// 1234.57
[心得] use C/C++ write PHP Extension
SESSION_START
今天把uniserver3.2升級成uniserver3.5囉!
大致上似乎沒有太大的差別,不過我是為了要使用JSON這個功能 (PHP 5.2以上才有支援的樣子)
www跟mysql\data資料全部複製過去就可以啟動囉 (所以我猜測資料庫版本沒有變動)
唯一遇到的錯誤訊息就是,session_start出現錯誤~~
cannot send session cache limiter-headers already sent
通常遇到這問題,是在用session之前,你已經先將其他資料印出來了~
不過後來發現其實還有其他原因也會造成這個問題~~
[引用了UTF-8格式的文件]
有些UTF-8格式的文件會在文件的開始放入判斷字元(BOM),可以啟用PHP.INI的設定
output_buffering = 4096 或是採用類似SMARTY樣版的方式來避免類似問題發生
不過我卻發現舊版的php.ini中裡面已經存在這行囉! (所以我之前當然可以用囉)
原文:台灣PHP聯盟
Recent Comments