[PHP]如何用程式刊登文章到 Google Blogger/blogspot 部落格

How To Post To Blogger with PHP?

以下將說明如何用 PHP 程式去刊登文章到 Google 的 blogspot 部落格. 在程式中我們會用到 Zend Framework 函式庫 (library) 的功能, 然後透過 Google blogger 之 feeds 介面來刊登文章到 Google blogspot 部落格; 文章中我們也嘗試將為 class SimpleCRUD 範例程式新增一個函式以更方便文章刊登. Continue reading “[PHP]如何用程式刊登文章到 Google Blogger/blogspot 部落格”

[PHP] 解決中文郵件寄件者, 收件者名稱, 信件標題亂碼問題

[PHP] 解決(非 ASCII 編碼)中文郵件寄件者或中文郵件收件者名稱, 或中文信件標題亂碼問題

在 PHP 程式中想要傳送一封含有非 ASCII 編碼(例如: UTF-8編碼)之信件寄件者或信件收件者名稱, 或郵件標題/主旨(subject) 的 email 時, 要根據 RFC 2047 [1] 對 “信件寄件者” 或 “信件收件者” 名稱, 或 “郵件標題/主旨” 做編碼後才能傳送, 不然會遇到亂碼問題 (寄件者或信件收件者名稱, 或郵件標題/主旨出現亂碼).

RFC 2047 中提到的編碼方式有以下兩種:
Continue reading “[PHP] 解決中文郵件寄件者, 收件者名稱, 信件標題亂碼問題”

[PHP] 用密件副本(BCC)傳送 email 的方法

How to send a B.C.C. E-mail in PHP?

在 PHP 程式中我們會用 mail() 函式來發送 email, 其 prototype 為:

bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

其中必要的欄位有:

  1. to: 要送給誰
  2. subject: 信件的標題/主旨
  3. message: 信件內容

一般的使用程式範例: Continue reading “[PHP] 用密件副本(BCC)傳送 email 的方法”

[WEB][PHP] 關於網站線上人數統計的實做

[WEB][PHP] 關於網站線上人數統計的實做

如果網頁是使用 PHP 來寫的話,可以很容易做到基本的網站人數統計功能。

1. 去改寫 session 的處理方式,例如以下是將原本存到 file 的 session 資料變成存到 MySql 之類的 (memory) database. (註一):

去用 session_set_save_handler() 函式改寫 session 在

  • open(),
  • close(),
  • read(),
  • write(),
  • destroy(),
  • Gc()

時的處理方式。

其中: Continue reading “[WEB][PHP] 關於網站線上人數統計的實做”

安裝 PHP 時出現error: Cannot find MySQL header files under yes的錯誤訊息

[服務架設][系統]安裝 PHP 時出現error: Cannot find MySQL header files under yes的錯誤訊息

安裝 PHP 時,剛執行 ./configure –with-apxs2=/usr/local/Apache2/bin/apxs –with-mysql
就出現以下錯誤訊息:

…..
checking for mSQL support… no
checking for MSSQL support via FreeTDS… no
checking for MySQL support… yes
checking for specified location of the MySQL UNIX socket… no
checking for MySQL UNIX socket location… /tmp/mysql.sock
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore.

解法:

o 如果不知道 header file 在哪,用 「find / -name mysql.h」命令找出其位置;
o 如果是自己也有手動安裝 MySQL 套件的話,直接指定該位置。

在 ./configure 下參數指定 header file 的位置,如下:

./configure –with-apxs2=/usr/local/Apache2/bin/apxs –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config

這篇文章的關鍵字:
PHP install (PHP安裝), MySQL header files

[LINUX]安裝 PHP 時出現undefined reference to `libiconv_open’ 之類的錯誤訊息

[服務架設][系統][LINUX]安裝 PHP 時出現undefined reference to `libiconv_open’ 之類的錯誤訊息

安裝環境: Linux Fedora Core 3 上安裝 php-5.2.0

在安裝 PHP 到系統中時要是發生「undefined reference to `libiconv_open’」之類的錯誤訊息,那表示在「./configure 」沒抓好一些環境變數值。錯誤發生點在建立「-o sapi/cli/php」時出錯,沒給到要 link 的 iconv 函式庫參數。

快速的解法是: Continue reading “[LINUX]安裝 PHP 時出現undefined reference to `libiconv_open’ 之類的錯誤訊息”

[WEB][PHP][SEO] 轉導、轉向(Redirect)網址的方法.

[WEB][PHP][SEO] 轉導、轉向(Redirect)網址的方法

在將網站更換成新網址的情況下,可能會在舊網址上使用到一些『轉導網址』的方法,以便將原本的使用者及其流量引導到新的網址去。

以下整理、討論到幾種轉導(Redirect)網址的技術方法,並且探討該方法對 SEO 的影響: Continue reading “[WEB][PHP][SEO] 轉導、轉向(Redirect)網址的方法.”