Core PHP programming using PHP to build dynamic web sites

671 385 0
Core PHP programming   using PHP to build dynamic web sites

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Tài liệu về học lập trình web bằng ngôn ngữ PHP cho tất cả mọi người.

Core PHP Programming IT-SC book 1 Core PHP Programming Using PHP to Build Dynamic Web Sites Leon Atkinson Publisher: Prentice Hall PTR Second Edition August 03, 2000 ISBN: 0-13-089398-6, 800 pages Master PHP 4 — the open source Web scripting breakthrough! Contains expert coverage of syntax, functions, design, and debugging! Leverage the amazing performance of the new Zend engine! 650+ real-world code examples! CD-ROM includes source code, plus everything you’ll need to run PHP 4 implementations on Windows and UNIX! This is the experienced developer’s guide to PHP. Master PHP 4, the open source, high-performance, cross-platform solution for server-side scripting! Core PHP Programming, Second Edition is the #1 practical guide to PHP 4 for Web developers. With the guidance of top PHP developer Leon Atkinson, you’ll learn everything you’ll need to build robust, fast Web applications — and deploy them on leading Web servers, from Apache to Microsoft Internet Information Server. Atkinson covers PHP syntax, the key building blocks of PHP scripts, and every PHP function, including I/O, data, and math functions, time, date, configuration, database, graphics, and network functions. He presents PHP at work in sample code that demonstrates sorting, searching, parsing, string evaluation, and more. You’ll even find detailed, real-world insights into PHP 4 program design and debugging! Core PHP Programming delivers: Core PHP Programming IT-SC book 2 Thorough, easy-to-understand coverage of PHP syntax and functions Step-by-step guidance for PHP database integration Design and optimization techniques for maximum performance and extensibility Practical debugging solutions Companion CD-ROM includes PHP 4 source code and Windows binaries plus all the code examples from the book! Core PHP Programming IT-SC book 3 CORE PHP Programming Using PHP to Build Dynamic Web Sites Library of Congress Cataloging-in-Publication Date Atkinson, Leon. Core PHP programming : using PHP to build dynamic Web sites / Leon Atkinson 2nd ed. p. cm. Includes bibliographical references and index. 1. PHP (Computer program language) 2. Web sites Design. I. Title. QA76.73.P22A85 2000 005.2'762 dc21 00-034019 Core PHP Programming IT-SC book 4 Credits Editorial/Production Supervision: Jan H. Schwartz Acquisitions Editor: Mark Taub Editorial Assistant: Sarah Hand Marketing Manager: Kate Hargett Manufacturing Manager: Alexis Heydt Cover Design: Talar Agasyan Cover Design Director: Jerry Votta Art Director: Gail Cocker-Bogusz Series Interior Design: Meg VanArsdale Core PHP Programming IT-SC book 5 © 2001 Prentice Hall PTR All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher. All product names mentioned herein are the trademarks or registered trademarks of their respective owners. Printed in the United States of America 10 9 8 7 6 5 4 3 2 1 Prentice-Hall International (UK) Limited, London Prentice-Hall of Australia Pty. Limited, Sydney Prentice-Hall Canada Inc., Toronto Prentice-Hall Hispanoamericana, S.A., Mexico Prentice-Hall of India Private Limited, New Delhi Prentice-Hall of Japan, Inc., Tokyo Pearson Education Asia Pte. Ltd. Editora Prentice-Hall do Brasil, Ltda., Rio de Janeiro Core PHP Programming IT-SC book 6 Foreword 16 Preface 18 Acknowledgments 20 Part I: PROGRAMMING WITH PHP 21 Chapter 1. AN INTRODUCTION TO PHP 22 The Origins of PHP 22 What Makes PHP Better than Its Alternatives 24 Interfaces to External Systems 25 How PHP Works with the Web Server 26 Hardware and Software Requirements 26 Installation on Apache for UNIX 27 Installation on IIS for Windows NT 29 Editing Scripts 30 Algorithms 30 What a PHP Script Looks Like 31 Saving Data for Later 33 Receiving User Input 35 Choosing between Alternatives 38 Repeating Code 39 Conclusion 40 Chapter 2. VARIABLES, OPERATORS, AND EXPRESSIONS 41 Identifiers 41 Data Types 41 Variable Creation and Scope 45 Assigning Values to Variables 49 Retrieving Values 51 Freeing Memory 52 Constants 52 Operators 53 Logical and Relational Operators 54 Bitwise Operators 55 Miscellaneous Operators 56 Assignment Operators 59 Expressions 60 Chapter 3. CONTROL STATEMENTS 63 True and False 63 The if Statement 63 The ? Operator 64 The switch Statement 68 Loops 70 The while Statement 70 The break Statement 73 Core PHP Programming IT-SC book 7 The continue Statement 73 The do while Statement 76 The for Statement 76 The foreach Statement 79 exit, die, and return 79 Evaluation of Boolean Expressions 80 Chapter 4. FUNCTIONS 81 Declaring a Function 81 The return Statement 82 Scope and the global Statement 83 Arguments 83 Recursion 86 Dynamic Function Calls 89 Chapter 5. ARRAYS 90 Single-Dimensional Arrays 90 Indexing Arrays 91 Initializing Arrays 93 Multidimensional Arrays 94 Casting Arrays 95 Referencing Arrays Inside Strings 98 Chapter 6. CLASSES AND OBJECTS 100 Defining a Class 101 Creating an Object 105 Accessing Properties and Methods 105 Chapter 7. I/O AND DISK ACCESS 109 HTTP Connections 109 Writing to the Browser 111 Output Buffering 112 Environment Variables 112 Getting Input from Forms 113 Cookies 115 File Uploads 115 PUT Method Requests 117 Reading and Writing to Files 117 Sessions 119 The include and require Functions 121 Part II: FUNCTIONAL REFERENCE 123 Chapter 8. I/O FUNCTIONS 123 Sending Text to the Browser 124 Output Buffering 126 Files 127 Compressed File Functions 163 POSIX 168 Core PHP Programming IT-SC book 8 Debugging 173 Session Handling 195 Shell Commands 198 HTTP Headers 200 Network I/O 202 FTP 207 Chapter 9. DATA FUNCTIONS 215 Data Types, Constants, and Variables 215 Arrays 221 Hashing 243 Strings 247 Encoding and Decoding 255 Encryption 277 Regular Expressions 282 Perl-Compatible Regular Expressions 285 Chapter 10. MATHEMATICAL FUNCTIONS 291 Common Math 291 Random Numbers 299 Arbitrary-Precision Numbers 302 Chapter 11. TIME, DATE, AND CONFIGURATION FUNCTIONS 305 Time and Date 305 Alternative Calendars 312 Configuration 316 Chapter 12. IMAGE FUNCTIONS 323 Analyzing Images 323 Creating JPEG, PNG, and WBMP Images 325 Chapter 13. DATABASE FUNCTIONS 356 dBase 356 DBM-style Database Abstraction 361 filePro 366 Informix 368 InterBase 375 mSQL 380 ODBC 406 Oracle 417 Postgres 436 Sybase 445 Chapter 14. MISCELLANEOUS FUNCTIONS 454 Apache 454 Aspell 459 COM 460 Gettext 462 IMAP 463 Java 485 Core PHP Programming IT-SC book 9 LDAP 486 Semaphores 498 Shared Memory 500 SNMP 504 WDDX 507 XML 510 Part III: ALGORITHMS 520 Chapter 15. SORTING, SEARCHING, AND RANDOM NUMBERS 521 Sorting 521 Bubble Sort 522 Quicksort 526 Built-In Sorting Functions 528 Sorting with a Comparison Function 537 Searching 540 Indexing 540 Random Numbers 547 Random Identifiers 548 Choosing Banner Ads 549 Chapter 16. PARSING AND STRING EVALUATION 552 Tokenizing 552 Regular Expressions 555 Defining Regular Expressions 555 Using Regular Expressions in PHP Scripts 557 Chapter 17. DATABASE INTEGRATION 568 Building HTML Tables from SQL Queries 568 Tracking Visitors with Session Identifiers 575 Storing Content in a Database 579 Database Abstraction Layers 583 Chapter 18. NETWORK 585 HTTP Authentication 585 Controlling Browser Cache 587 Setting Document Type 589 Email with Attachments 590 Verifying an Email Address 594 Chapter 19. GENERATING GRAPHICS 600 Dynamic Buttons 600 Generating Graphs on the Fly 605 Bar Graphs 606 Pie Charts 609 Stretching Single-Pixel Images 612 Part IV: SOFTWARE ENGINEERING 614 Chapter 20. INTEGRATION WITH HTML 615 Sprinkling PHP within an HTML Document 615 Using PHP to Output All HTML 619 [...]... quickly learning PHP functionality Commercial backing and reference materials will continue to drive PHP' s gradual acceptance as the standard in Web scripting IT-SC book 16 Core PHP Programming Let me take this opportunity to thank everybody for bringing PHP to where it is today May we keep on working together to make it even better! I hope this book will give novices a quick start to PHP and more experienced... in the Web pages themselves Support for PHP is free and readily available Queries to the PHP mailing list are often answered within hours A custom bug-tracking system on the PHP site shows each problem along with its resolution Numerous sites, such as phpbuilder.com and zend.com, offer original content to PHP developers PHP is popular Internet service providers find PHP to be an attractive way to allow... took the time to send me email The response has been overwhelmingly positive I'm delighted to have introduced so many people to PHP IT-SC book 20 Core PHP Programming Part I: PROGRAMMING WITH PHP The first part of this book is a thorough discussion of PHP as a programming language You will be introduced to common concepts of computer science and how they are implemented in PHP No prior programming experience... available IT-SC book 24 Core PHP Programming PHP runs on UNIX, Windows 98, Windows NT, and the Macintosh PHP is designed to integrate with the Apache Web Server Apache, another free technology, is the most popular Web server on the Internet and comes with source code for UNIX and Windows Commercial flavors of Apache like WebTen and Stronghold support PHP, too But PHP works with other Web servers, including... live Web sites I have worked on since discovering PHP in 1997 Others are distilled from the continual discussion being conducted on the PHP mailing lists IT-SC book 18 Core PHP Programming This book is organized into four main sections: an introduction to programming; a reference for all the functions in PHP; a survey of common programming problems; and finally a guide for applying this knowledge to Web. .. discussion The PHPLib project provided a framework for handling user sessions that inspired new code in PHP FreeTrade, a project I lead, offered a toolkit for building e-commerce sites Writing about PHP increased as well More than twenty articles appeared on high-traffic sites such as webmonkey.com and techweb.com Sites dedicated to supporting PHP developers were launched The first two books about PHP were... called PHP: Dynamische Webauftritte professionell realisieren Prentice Hall published the first edition of my book, Core PHP Programming Since then several other books have been published and others planned PHP is not a shrink-wrapped product made by faceless drones or wizards in an ivory tower PHP started as a simple tool brought into the bazaar described by Eric Raymond in IT-SC book 23 Core PHP Programming. .. 669 IT-SC book 10 Core PHP Programming Foreword Preface Acknowledgments I: PROGRAMMING WITH PHP 1 AN INTRODUCTION TO PHP The Origins of PHP What Makes PHP Better than Its Alternatives Interfaces to External Systems How PHP Works with the Web Server Hardware and Software Requirements Installation on Apache for UNIX Installation on IIS for Windows NT Editing Scripts Algorithms What a PHP Script Looks... development solution and began to be used for commercial Web sites In 1996 Clear Ink created the SuperCuts site (www supercuts.com) and used PHP to created a custom experience for the Web surfer In January of 1999 the PHP Web site reported almost 100,000 Web servers were using PHP By November that figure had climbed higher than 350,000! A community of developers grew up around PHP Feature requests were... to be an attractive way to allow their customers to code Web applications without the risks exposed by CGIs Developers worldwide offer PHP programming Sites coded in PHP will have the option of moving from one host to another as well as a choice of developers to add functionality Programming skills developed in other structured languages can be applied to PHP PHP takes inspiration from both Perl and . Programming Using PHP to Build Dynamic Web Sites Library of Congress Cataloging-in-Publication Date Atkinson, Leon. Core PHP programming : using PHP to build dynamic. Core PHP Programming IT-SC book 1 Core PHP Programming Using PHP to Build Dynamic Web Sites Leon Atkinson Publisher:

Ngày đăng: 24/01/2014, 14:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan