1. Trang chủ
  2. » Công Nghệ Thông Tin

Teach your self PHP

593 21 0

Đ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

Nội dung

This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] • • Table of Contents Index Sams Teach Yourself PHP in 24 Hours, Third Edition By Matt Zandstra Publisher: Sams Publishing Pub Date: December 23, 2003 ISBN: 0-672-32619-1 Pages: 500 A quick, easy-to-understand introduction to creating dynamic Web sites with PHP 5, the latest version of this popular programming language Updated and revised to cover features of the latest version of PHP,PHP Quickly teaches the reader the basics of PHP and how to make use of it in practical applications Teaches the reader to create dynamic Web applications and set-up a secure PHP environment [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] • • Table of Contents Index Sams Teach Yourself PHP in 24 Hours, Third Edition By Matt Zandstra Publisher: Sams Publishing Pub Date: December 23, 2003 ISBN: 0-672-32619-1 Pages: 500 Copyright About the Author Acknowledgments Tell Us What You Think! Introduction Who Should Read This Book? How This Book Is Organized Part I: Getting Started Hour PHP: From Home Page to Web Enterprise What Is PHP? What Need Does PHP Fulfill? What's New in PHP The Zend Engine Why Choose PHP? What's New in This Edition Summary Q&A Workshop Exercise Hour Installing PHP Platforms, Servers, Databases, and PHP Where to Find PHP and More Installing PHP for Linux and Apache Some configure Options Configuring Apache php.ini Help! Summary This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Summary Q&A Workshop Exercise Hour A First Script Our First Script Combining HTML and PHP Adding Comments to PHP Code Summary Q&A Workshop Exercise Part II: The Language Hour The Building Blocks Variables Data Types Operators and Expressions Constants Summary Q&A Workshop Exercises Hour Going with the Flow Switching Flow Loops Code Blocks and Browser Output Summary Q&A Workshop Exercises Hour Functions What Is a Function? Calling Functions Defining a Function Returning Values from User-Defined Functions Dynamic Function Calls Variable Scope Saving State Between Function Calls with the static Statement More About Arguments Creating Anonymous Functions Testing for Function Existence Summary Q&A Workshop Exercise Hour Arrays What Is an Array? Creating Arrays Associative Arrays Multidimensional Arrays Accessing Arrays Manipulating Arrays Sorting Arrays This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Functions Revisited Summary Q&A Workshop Exercises Hour Working with Strings Formatting Strings Investigating Strings Manipulating Strings Summary Q&A Workshop Exercises Hour Objects What Is an Object? Creating an Object Object Properties Object Methods Limiting Access to Object Properties Limiting Access to Object Methods Constraining Arguments to Methods with Hints Inheritance Testing Classes and Objects Automatically Loading Include Files with _autoload() Storing and Retrieving Objects Summary Q&A Workshop Exercises Part III : Working with PHP Hour 10 Working with Forms Superglobal Variables The $_SERVER Array A Script to Acquire User Input Importing User Input into Global Scope Accessing Form Input with User-Defined Arrays Combining HTML and PHP Code on a Single Page Using Hidden Fields to Save State Redirecting the User File Upload Forms and Scripts Summary Q&A Workshop Exercises Hour 11 Working with Files Including Files with include() Using include_once() and include_path to Manage Larger Projects Testing Files Creating and Deleting Files Opening a File for Writing, Reading, or Appending Reading from Files Reading the Contents of a File with file_get_contents() This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Writing or Appending to a File Writing Data to a File with file_put_contents() Working with Directories Summary Q&A Workshop Exercises Hour 12 Working with the DBA Functions Beneath the Abstraction Opening a Database Adding Data to the Database Amending Elements in a Database Reading from a Database Determining Whether an Item Exists in a Database Deleting an Item from a Database Adding Complex Data Structures to a Database An Example Summary Q&A Workshop Exercises Hour 13 Database Integration—SQL A (Very) Brief Introduction to SQL Connecting to the MySQL Database Server Selecting a Database Finding Out About Errors Adding Data to a Table Acquiring the Value of an Automatically Incremented Field Accessing Information Changing Data SQLite: A Lightweight SQL Engine Selecting Data Using the PEAR DB Package Summary Q&A Workshop Exercises Hour 14 Beyond the Box Server Variables Revisited A Brief Summary of an HTTP Client/Server Negotiation Getting a Document from a Remote Address Converting IP Addresses and Hostnames Making a Network Connection Sending Mail with the mail() Function An Introduction to Streams Summary Q&A Workshop Exercises Hour 15 Images On-the-Fly Checking Your Configuration with gd_info() Creating and Outputting Images This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Acquiring Color Drawing Lines Applying Color Fills Drawing an Arc Drawing a Rectangle Drawing a Polygon Making a Color Transparent Working with Text Bringing It Together Summary Q&A Workshop Exercises Hour 16 Working with Dates and Times Getting the Date with time() Converting a Timestamp with getdate() Converting a Timestamp with date() Creating Timestamps with mktime() An Example A Date Pull-down Library Summary Q&A Workshop Exercise Hour 17 Advanced Objects Objects and Constants Static Properties Static Methods Intercepting Calls to Object Properties and Methods Final Methods Cleaning Up Using Destructors Managing Error Conditions with Exceptions Tools for Building Object Hierarchies Passing and Assigning Objects Summary Q&A Workshop Exercises Hour 18 Working with Regular Expressions Perl Compatible Regular Expressions Summary Q&A Workshop Exercise Hour 19 Saving State with Cookies and Query Strings Cookies Setting a Cookie with PHP Working with the Query String Creating a Query String Summary Q&A Workshop This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Exercises Hour 20 Saving State with Session Functions What Are Session Functions? Starting a Session with session_start() Working with Session Variables Destroying Sessions and Unsetting Elements Passing Session IDs in the Query String Encoding and Decoding Session Variables Summary Q&A Workshop Exercises Hour 21 Working with the Server Environment Opening Pipes to and from Processes with popen() and proc_open() Running Commands with exec() Running External Commands with system() or the Backtick Operator Plugging Security Holes with escapeshellcmd() Running External Applications with passthru() Calling an External CGI Script with the virtual() Function Summary Q&A Workshop Exercises Hour 22 XML What Is XML? XML Parser Functions An Introduction to the DOM XML Functions XSL: A Brief Discussion Introducing SimpleXML Summary Q&A Workshop Exercises Part IV: Extending PHP Hour 23 PEAR: Reusable Components to Extend the Power of PHP What Is PEAR? Some PEAR Packages in Action PEAR and Your Own Code Summary Q&A Workshop Exercises Hour 24 Toward a Framework for Larger Projects Principles and Problems The Controller Object The RequestHelper and DataStore Classes The CommandFactory Class The Command Class The Dispatcher Class Working with the Framework Where Now, and Was It Worth It? Summary This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Q&A Workshop Exercises Glossary Index [ Team LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ Team LiB ] Copyright Copyright © 2004 by Sams Publishing All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the information contained herein Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions Nor is any liability assumed for damages resulting from the use of the information contained herein Library of Congress Catalog Card Number: 2003109402 Printed in the United States of America First Printing: December 2003 06 05 04 03 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized Sams Publishing cannot attest to the accuracy of this information Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied The information provided is on an "as is" basis The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the programs accompanying it Bulk Sales Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales For more information, please contact: U.S Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact: International Sales +1-317-581-3793 international@pearsontechgroup.com Acquisitions Editor Shelley Johnston Development Editor Scott D Meyers Managing Editor Charlotte Clapp Project Editor George Nedeff Production Editor Megan Wade Indexer This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Indexer Heather McNeill Proofreader Juli Cook Technical Editors Steph Fox Brian France Sara Goteman Chris Newman Team Coordinator Vanessa Evans Designer Gary Adair Page Layout Stacey Richwine-DeRome Dedication For my father Who would have approved [ Team LiB ] ... ] Hour PHP: From Home Page to Web Enterprise What You'll Learn In This Hour: What PHP is About PHP' s history What improvements can be found in PHP Some options that add features to your PHP binary... Exercise Hour Installing PHP Platforms, Servers, Databases, and PHP Where to Find PHP and More Installing PHP for Linux and Apache Some configure Options Configuring Apache php. ini Help! Summary... become a proficient PHP programmer Part IV, "Extending PHP, " examines library code, both code that you can create yourself and PEAR, a repository of library code you can include in your own projects

Ngày đăng: 26/03/2019, 11:23

w