此商品已下架,若仍需天瓏代為查詢或代購書籍,請與門市客服人員聯繫,或 E-mail 至 service@tenlong.com.tw 將有專人為您服務。

PHP 5 in Practice
暫譯: PHP 5 實務應用

Elliott White, Jonathan D. Eisenhamer

  • 出版商: SAMS
  • 出版日期: 2006-07-21
  • 售價: $1,880
  • 貴賓價: 9.5$1,786
  • 語言: 英文
  • 頁數: 456
  • 裝訂: Paperback
  • ISBN: 0672328887
  • ISBN-13: 9780672328886
  • 相關分類: PHP
  • 已絕版

買這商品的人也買了...

商品描述

Description

With the release of PHP 5 web developers need a guide to developing with PHP 5 to both learn its complex new features and more fully implement the long-standing features on which PHP's success is built. PHP 5 in Practice is a reference guide that provides developers with easy-to-use and easily extensible code to solve common PHP problems. It focuses on providing real code solutions to problems, allowing the reader to learn by seeing exactly what is happening behind the scenes to get your solution. Because a real-life situation will rarely match the book's example problems precisely, PHP 5 in Practice explains the solution well enough that you will understand it and can learn how to truly solve your own problem.

 

 

Table of Contents

Introduction  

Part I   PHP Internals

1   Strings  

1.1 Matching Patterns (Regular Expressions) 

1.2 Cleaning Up Whitespace 

1.3 Expanding and Compressing Tabs  

1.4 Converting Text Between Macintosh, UNIX, and PC Format  

1.5 Parsing CSV (Comma-Separated Values)  

1.6 Truncating Text to Fit Within a Specific Space  

1.7 Padding Arrays of Data to Display as Columns  

1.8 Checking the Spelling of a Word  

1.9 Matching Similar Strings  

1.10 Performing Proper Capitalization on Titles  

1.11 Generating Unique Identifiers  

1.12 Counting the Number of Times Certain Words Appear

2   Numbers  

2.1 Retrieving a Number from a String  

2.2 Printing Proper Plural Text  

2.3 Converting Numbers into Roman Numerals  

2.4 Calculating Interest  

2.5 Simulating Dice  

2.6 Latitude/Longitude Calculations  

2.7 Metric/English Conversion  

2.8 Temperature Conversion  

2.9 Statistics Package Creation  

3   Time and Date  

3.1 Calculating the Difference Between Two Dates  

3.2 Determining Last Day of a Given Month  

3.3 Leap Year Calculation  

3.4 Handling Time Zones  

3.5 Handling Time Stamps Within Databases or in Files  

3.6 Determining Number of Business Days  

3.7 Generating a Calendar for a Given Month  

4   Variables  

4.1 Determining Whether a Variable Is Equal to Another  

4.2 Accessing a Variable Outside a Function, from Within it (Global Variables)  

4.3 Keeping a Persistent Value Within a Function (Static Variables)  

4.4 Having One Variable Refer to Another (References)  

4.5 Using a Variable to Hold the Name of Another Variable  

4.6 Declaring a Constant Instead of a Variable  

4.7 Coalescing a List of Values to Determine the First Non-False Value  

5   Arrays  

5.1 Superglobal Arrays and Their Usage  

5.2 Stack Implementation  

5.3 Queue Implementation  

5.4 Sorting with User-Defined Comparisons  

5.5 Sorting with Alternative Algorithms  

5.6 Recursive Handling of Multidimensional Arrays  

5.7 Performing Set Operations on Arrays

5.8 Matrix Math Execution Using Arrays  

6   Functions  

6.1 Setting Optional Parameters  

6.2 Creating Recursive Functions  

6.3 Calling Functions Using a Function Name Stored in a Variable  

6.4 Dynamically Creating a Function (Lambda-Style)  

6.5 Using an Array of Functions for Processing  

6.6 Passing or Returning a Value by Reference  

6.7 Using an Arbitrary Number of Parameters  

6.8 Requiring a Parameter to Be a Certain Type  

7   Classes and Objects  

7.1 Automatically Loading Class Source Files  

7.2 Protecting Object Data (public/private/protected)  

7.3 Automatically Running Code On Creation or Destruction of an Object  

7.4 Accessing a Class’s Members Without Instantiation  

7.5 Extending a Class Definition  

7.6 Creating an Abstract Class  

7.7 Using Object Interfaces  

7.8 Dynamic and Overloaded Variable Names  

7.9 Overloading Methods  

7.10 Linked List Implementation  

7.11 Binary Tree Implementation  

8   Files and Directories  

8.1 Generating a Full Directory Listing  

8.2 Natural Display of File Sizes  

8.3 Renaming All Files Within a Directory  

8.4 Search for Filenames Within a Directory Tree  

8.5 Handling Relative and Absolute File Paths  

8.6 Reading a File Via HTTP or FTP  

8.7 Watching the Contents of a File As It Grows (Simulating UNIX tail -f)  

8.8 Generating a Difference Report Between Two Files  

8.9 Locking a File for Exclusive Use  

8.10 Caching Remote Files Locally  

8.11 Compressing and Uncompressing Files  

8.12 Automatically Including Certain Files from the Parent Tree  

Part II   Application

9   Web Page Creation/XHTML/CSS  

9.1 Creating a Multilayer Drop-Down Menu  

9.2 Highlighting What Section of a Website the User Is In  

9.3 Displaying Dynamic Progress Bars  

9.4 Simulating Graphical Charts with XHTML/CSS  

9.5 Pagination of Results on a Web Page  

9.6 Caching Web Page Output for Server Optimization  

9.7 Localizing a Web Page for Different Languages  

9.8 Using Ajax with PHP to Create an Interactive Web Page  

10   Web Form Handling  

10.1 Easily Obtaining Form Data  

10.2 Obtaining Multidimensional Arrays of Form Data  

10.3 Using GET and POST Form Data Together  

10.4 Accepting Uploaded Files  

10.5 Generating Select Statements  

10.6 Requiring Certain Fields to Be Filled Out  

10.7 Manipulating Text for Display on Bulletin Boards (BBCode)  

10.8 Accepting and Displaying User Data Giving Warnings for Links  

10.9 Preventing Multiple Form Submissions  

11   Data Validation and Standardization  

11.1 Phone Numbers  

11.2 ZIP Codes  

11.3 Social Security Numbers (SSNs)  

11.4 Numbers  

11.5 Credit Card Numbers  

11.6 Dates  

11.7 Email Accounts  

11.8 URLs  

12   Sessions and User Tracking  

12.1 Using Cookies to Remember Data  

12.2 Saving User Data with Sessions  

12.3 Customizing Display Settings for a User  

12.4 Creating a Library for Tracking a User Through Your Website  

12.5 Implementing a Simple Shopping Cart  

12.6 Passing Session Data Between Two Servers  

12.7 Parsing Specific Browser Information from Log Files  

13   Web Services and Other Protocols  

13.1 Submitting a POST HTTP Request with cURL  

13.2 Communicating with an LDAP Server  

13.3 Using Web Services Via SOAP  

13.4 Connecting to an FTP Server  

13.5 Creating a PHP-Based FTP Client  

13.6 Using Sockets to Connect to an Internet Server  

13.7 Creating Your Own Basic Web Server  

14   Relational Databases  

14.1 Communicating with MySQL  

14.2 Communicating with Oracle  

14.3 Communicating with PostgreSQL  

14.4 Communicating with Sybase  

14.5 Communicating with Microsoft SQL Server  

14.6 Communicating with SQLite  

14.7 Communicating with Databases Through ODBC  

14.8 Using an Abstraction Layer to Communicate with a Database (PDO)  

14.9 Implementing an SQLite Based Blog  

15   Other Data Storage Methods  

15.1 Creating and Reading CSV files  

15.2 Using Custom Text Files for Storage  

15.3 Accessing and Updating DBM-Style Databases  

15.4 Storing Data Via Serialize and Unserialize  

15.5 Automatically Creating and Updating PHP Include Files  

16   Email  

16.1 Sending Email (Text/HTML/Dual Format/Inline Images/Attachments)  

16.2 Determining Whether an Email Account Exists  

16.3 Creating a Mass Email Mailer  

16.4 Implementing Basic Mailing List Software  

16.5 Protecting Email Addresses from Spam Collectors  

16.6 Creating a Watchdog Process to Send Email If a Web Page Changes  

17   XML  

17.1 Parsing an XML File to Retrieve Data  

17.2 Performing Searches Through XML with XPath  

17.3 Validating an XML Document  

17.4 Transforming XML into XHTML with XSLT  

17.5 Creating an RSS File  

17.6 Creating an RSS Display Script for Websites  

18   Images  

18.1 Generating Composite Images with Text  

18.2 Drawing Tips and Tricks  

18.3 Using Transparent Backgrounds in Images  

18.4 Creating a Graph/Chart Library  

18.5 Automatically Creating a Photo Gallery from Digital Camera Files (Exif Data)  

19   Error Reporting and Debugging  

19.1 Defining a Custom Error Handler  

19.2 Using Exceptions to Handle Errors  

19.3 Timing the Execution of Your Script  

19.4 Using Shutdown Functions to Gracefully Handle Script Failures  

19.5 Generating Detailed Backtracing for Error Reporting  

20   User Authentication and Encryption  

20.1 Generating Random Passwords  

20.2 Using Encryption to Protect Data  

20.3 Simple CAPTCHA for Real User Detection  

20.4 Authenticating Users  

Part III   Appendixes

A   Migrating to PHP 5  

B   SPL  

C   Common PHP Error Messages  

Index  

商品描述(中文翻譯)

**描述**

隨著 PHP 5 的發布,網頁開發者需要一本指南來學習 PHP 5 的複雜新特性,並更全面地實現 PHP 成功所依賴的長期特性。《PHP 5 實務應用》是一本參考指南,為開發者提供易於使用和易於擴展的代碼,以解決常見的 PHP 問題。它專注於提供實際的代碼解決方案,讓讀者能夠通過看到背後發生的事情來學習如何獲得解決方案。由於現實情況很少與書中的示例問題完全匹配,《PHP 5 實務應用》充分解釋了解決方案,使您能夠理解並學會如何真正解決自己的問題。

**目錄**

引言
第一部分 PHP 內部
1 字串
1.1 匹配模式(正則表達式)
1.2 清理空白字元
1.3 展開和壓縮制表符
1.4 在 Macintosh、UNIX 和 PC 格式之間轉換文本
1.5 解析 CSV(逗號分隔值)
1.6 截斷文本以適應特定空間
1.7 填充數據陣列以顯示為列
1.8 檢查單詞的拼寫
1.9 匹配相似字串
1.10 對標題進行正確的大小寫處理
1.11 生成唯一標識符
1.12 計算某些單詞出現的次數
2 數字
2.1 從字串中檢索數字
2.2 正確打印複數文本
2.3 將數字轉換為羅馬數字
2.4 計算利息
2.5 模擬擲骰子
2.6 緯度/經度計算
2.7 公制/英制轉換
2.8 溫度轉換
2.9 統計包創建
3 時間和日期
3.1 計算兩個日期之間的差異
3.2 確定給定月份的最後一天
3.3 閏年計算
3.4 處理時區
3.5 處理數據庫或文件中的時間戳
3.6 確定工作日的數量
3.7 為給定月份生成日曆
4 變數
4.1 確定變數是否等於另一個變數
4.2 從函數外部訪問變數(全域變數)
4.3 在函數內保持持久值(靜態變數)
4.4 使一個變數引用另一個變數(引用)
4.5 使用變數來保存另一個變數的名稱
4.6 聲明常量而不是變數
4.7 合併值列表以確定第一個非假值
5 陣列
5.1 超全域陣列及其用法
5.2 堆疊實現
5.3 隊列實現
5.4 使用用戶定義的比較進行排序
5.5 使用替代算法進行排序
5.6 遞歸處理多維陣列
5.7 在陣列上執行集合操作
5.8 使用陣列執行矩陣運算
6 函數
6.1 設置可選參數
6.2 創建遞歸函數
6.3 使用存儲在變數中的函數名稱調用函數
6.4 動態創建函數(Lambda 風格)
6.5 使用函數陣列進行處理
6.6 通過引用傳遞或返回值
6.7 使用任意數量的參數
6.8 要求參數為特定類型
7 類和物件
7.1 自動加載類源文件
7.2 保護物件數據(公有/私有/保護)
7.3 在創建或銷毀物件時自動運行代碼
7.4 在不實例化的情況下訪問類的成員
7.5 擴展類定義
7.6 創建抽象類
7.7 使用物件介面
7.8 動態和重載變數名稱
7.9 重載方法
7.10 鏈表實現
7.11 二叉樹實現
8 文件和目錄
8.1 生成完整的目錄列表
8.2 自然顯示文件大小
8.3 重命名目錄中的所有文件
8.4 在目錄樹中搜索文件名
8.5 處理相對和絕對文件路徑
8.6 通過 HTTP 或 FTP 讀取文件
8.7 監視文件內容隨著增長(模擬 UNIX tail -f)
8.8 生成兩個文件之間的差異報告
8.9 鎖定文件以供獨佔使用
8.10 在本地緩存遠程文件
8.11 壓縮和解壓縮文件
8.12 自動從父樹中包含某些文件
第二部分 應用
9 網頁創建/XHTML/CSS
9.1 創建多層下拉菜單
9.2 突出顯示用戶所在網站的部分
9.3 顯示動態進度條
9.4 使用 XHTML/CSS 模擬圖形圖表
9.5 網頁結果的分頁
9.6 緩存網頁輸出以優化伺服器
9.7 為不同語言本地化網頁
9.8 使用 Ajax 和 PHP 創建互動網頁
10 網頁表單處理
10.1 輕鬆獲取表單數據
10.2 獲取多維陣列的表單數據
10.3 同時使用 GET 和 POST 表單數據
10.4 接受上傳的文件
10.5 生成選擇語句
10.6 要求填寫某些字段
10.7 操作文本以在公告欄上顯示(BBCode)
10.8 接受和顯示用戶數據並對鏈接給予警告
10.9 防止多次提交表單
11 數據驗證和標準化
11.1 電話號碼
11.2 郵政編碼
11.3 社會安全號碼(SSN)
11.4 數字
11.5 信用卡號
11.6 日期
11.7 電子郵件帳戶
11.8 URL
12 會話和用戶追蹤
12.1 使用 Cookies 記住數據
12.2 使用會話保存用戶數據
12.3 自定義用戶的顯示設置
12.4 創建一個庫以追蹤用戶在您的網站上的行為
12.5 實現簡單的購物車
12.6 在兩個伺服器之間傳遞會話數據
12.7 從日誌文件中解析特定的瀏覽器信息
13 網路服務和其他協議
13.1 使用 cURL 提交 POST HTTP 請求
13.2 與 LDAP 伺服器通信
13.3 通過 SOAP 使用網路服務
13.4 連接到 FTP 伺服器