blog.Ring.idv.tw

Articles

PHP Data Objects (PDO) 介紹

PHP Data Objects

The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for 
accessing databases in PHP. Each database driver that implements the PDO interface can expose 
database-specific features as regular extension functions. Note that you cannot perform any 
database functions using the PDO extension by itself; you must use a database-specific PDO 
driver to access a database server.

其實和JDBC是同樣的意思,兩者都是抽象層的產物,意指為提供了一致性的介面來存取資料庫,這在移植不同的資料庫時是相當方便的。

PECL4WIN,這裡提供了Windows平臺的擴充下載,當你要使用Zend_Db來連結資料庫時,請務必下載PDO的DLL檔,並設定php.ini才行。

PostgreSQL範例

設定php.ini

extension=php_pdo.dll

extension=php_pdo_pgsql.dll

Zend_Db程式片段

$params = array (
    'host'     => 'localhost',
    'username' => 'postgres',
    'password' => '****',
    'dbname'   => 'MyDB'
);	

$db = Zend_Db::factory('PDO_PGSQL', $params);
$db->setFetchMode(Zend_Db::FETCH_OBJ);
$result = $db->fetchAll('SELECT * FROM books');
$this->view->rs = $result;

2007-10-10 10:28:07 | Add Comment

Zend PHP 5 Certification

看了一下Zend PHP5 Certification,居然PHP也有認證~

而且目前臺灣通過的只有一位(其它四位應該算是PHP4),我想考古題應該也不多~

考試結果只有分通過或不通過兩種,分數將不會公佈,感覺跟博士班的資格考很像~

在90分鐘的測驗時間中必須作答70個題目,其中包含單選題、多選題和填充題,考一次需要$US:125,大約台幣5000吧~ 如果你有興趣的話可以做一下練習題~

有時間的話或許我該準備考看看~ Anyway, 先忙論文好了~

相關資源:

PHP 5 Certification FAQs

Zend PHP5 認證自我測試

Introducing the Zend PHP 5 Certification

2007-10-07 22:42:14 | Add Comment

Chris Shiflett -- Zend Framework Tutorial

PHP安全專家兼Zend Framework的貢獻者--Chris Shiflett

提供了一篇Zend Framework Tutorial,有興趣的人可以參考看看~

這裡也已經有了中譯版Zend Framework 指南

2007-10-07 21:49:15 | Add Comment

在Zend Framework上開發一個HelloWorld

趁著今天剛好有點時間~ 來玩玩PHP順便試試Zend Framework~

本文所使用的範例均參考Zend_Controller Quick Start.來製作,並稍加擴充~

由於筆者涉獵未深,如果你有興趣的話,請參考Zend Framework官方文件的詳加說明~

作業環境

Windows XP Home(SP2)

Apache 2.2.6

PHP 5.2.4

Zend Framework 1.0.2

Apache rewrite_module設定

1.將rewrite_module啟用(LoadModule rewrite_module modules/mod_rewrite.so)

2.將<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">底下的AllowOverride設為All

HelloWorld安裝步驟

1.下載Zend Framework.

2.解壓縮後將目錄下的library複製到C:\Program Files\PHP\ (這是筆者測試環境,你可以自由更改)

3.修改php.ini中的include_path = ".;C:\Program Files\PHP\library" (如果前面有;分號,請拿掉)

4.下載筆者寫好的HelloWorld

5.直接解壓縮在htdocs目錄底下即可

最後打開你的瀏覽器~

試一下http://127.0.0.1/、http://127.0.0.1/index、http://127.0.0.1/index/hello

可以發現屬於你的第一個Zend Framework範例已經架構完成了~

希望本文能減少許多對此感興趣的朋友的摸索時間~

問題排除

1.確認安裝好Apache和PHP時,並在Apache的httpd.conf設定如下:

ServerName *:80

#加入PHP

AddType application/x-httpd-php .php .php3 .phtml

AddType application/x-httpd-php-source .phps

2.支援short tag,請修改php.ini

short_open_tag = On

參考資源:

1.Zend_Controller Quick Start.

2.Zend Framework安裝

2007-10-07 21:27:16 | Comments (4)

Adobe AIR beta 2 Released!

Adobe AIR beta 2已經在今天釋出了~Adobe Integrated Runtime (AIR) SDK也跟著更新了~

我想離正式版應該相去不遠了~

We are currently targeting the beginning of 2008 for the release of Adobe AIR 1.0. 

Beta 2所包含的新特色:

- System Tray icon/Dock Bar Bounce

- Synchronous database API(tm)

- Native menus

- Drag and drop enhancements including bitmap support

- Windowing improvements such as Z-order control and enhanced activation and focus support

- Improved Install dialog look and feel

- Application-initiated runtime updates

- HTML security model improvements

- Mouse support for double-click and scroll-wheel

- Per-machine runtime installs

- Performance and memory enhancements

- Hundreds of bug fixes

2007-10-01 17:30:14 | Comments (5)

Next Posts~:::~Previous Posts
Copyright (C) Ching-Shen Chen. All rights reserved.

::: 分類 :::

::: 最新文章 :::

::: 最新回應 :::