learning php mysql javascript and css 2nd edition

582 471 0
learning php mysql javascript and css 2nd edition

Đ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

lập trình web

www.it-ebooks.info www.it-ebooks.info SECOND EDITION Learning PHP, MySQL, JavaScript, and CSS Robin Nixon Beijing • Cambridge • Farnham • Kưln • Sebastopol • Tokyo www.it-ebooks.info Learning PHP, MySQL, JavaScript, and CSS, Second Edition by Robin Nixon Copyright © 2012 Robin Nixon All rights reserved Printed in the United States of America Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O’Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://my.safaribooksonline.com) For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com Editor: Andy Oram Production Editor: Iris Febres Copyeditor: Rachel Head Proofreader: Kiel Van Horn August 2012: Indexer: Ellen Troutman Zaig Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano Second Edition Revision History for the Second Edition: 2012-08-10 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449319267 for release details Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc Learning PHP, MySQL, JavaScript, and CSS, the image of sugar gliders, and related trade dress are trademarks of O’Reilly Media, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein ISBN: 978-1-449-31926-7 [LSI] 1344626556 www.it-ebooks.info For Julie www.it-ebooks.info www.it-ebooks.info Table of Contents Preface xvii Introduction to Dynamic Web Content HTTP and HTML: Berners-Lee’s Basics The Request/Response Procedure The Benefits of PHP, MySQL, JavaScript, and CSS Using PHP Using MySQL Using JavaScript Using CSS The Apache Web Server About Open Source Bringing It All Together Test Your Knowledge 2 5 9 10 10 12 Setting Up a Development Server 13 What Is a WAMP, MAMP, or LAMP? Installing a WAMP on Windows Testing the Installation Alternative WAMPs Installing a MAMP on OS X Configuring MySQL Testing the Installation Installing a LAMP on Linux Working Remotely Logging In Using FTP Using a Program Editor Using an IDE Test Your Knowledge 13 14 22 24 24 25 28 31 31 32 32 33 34 36 v www.it-ebooks.info Introduction to PHP 37 Incorporating PHP Within HTML Calling the PHP Parser This Book’s Examples The Structure of PHP Using Comments Basic Syntax Understanding Variables Operators Variable Assignment Multiple-Line Commands Variable Typing Constants The Difference Between the echo and print Commands Functions Variable Scope Test Your Knowledge 37 38 39 40 40 41 42 46 49 51 54 54 56 56 57 62 Expressions and Control Flow in PHP 65 Expressions Literals and Variables Operators Operator Precedence Associativity Relational Operators Conditionals The if Statement The else Statement The elseif Statement The switch Statement The ? Operator Looping while Loops do…while Loops for Loops Breaking Out of a Loop The continue Statement Implicit and Explicit Casting PHP Dynamic Linking Dynamic Linking in Action Test Your Knowledge vi | Table of Contents www.it-ebooks.info 65 66 67 68 70 71 75 75 76 78 78 81 82 83 85 85 87 88 89 90 90 91 PHP Functions and Objects 93 PHP Functions Defining a Function Returning a Value Returning an Array Passing by Reference Returning Global Variables Recap of Variable Scope Including and Requiring Files The include Statement Using include_once Using require and require_once PHP Version Compatibility PHP Objects Terminology Declaring a Class Creating an Object Accessing Objects Constructors Writing Methods Declaring Properties Declaring Constants Property and Method Scope in PHP Inheritance Test Your Knowledge 94 95 96 97 98 99 100 100 100 101 101 102 102 103 104 105 105 108 109 110 111 112 114 117 PHP Arrays 119 Basic Access Numerically Indexed Arrays Associative Arrays Assignment Using the array Keyword The foreach as Loop Multidimensional Arrays Using Array Functions is_array count sort shuffle explode extract compact reset end 119 119 121 122 122 124 127 127 127 128 128 128 129 130 131 131 Table of Contents | vii www.it-ebooks.info Test Your Knowledge 132 Practical PHP 133 Using printf Precision Setting String Padding Using sprintf Date and Time Functions Date Constants Using checkdate File Handling Checking Whether a File Exists Creating a File Reading from Files Copying Files Moving a File Deleting a File Updating Files Locking Files for Multiple Accesses Reading an Entire File Uploading Files System Calls XHTML The Benefits of XHTML XHTML Versions What’s Different? HTML 4.01 Document Types The HTML5 Document Type XHTML 1.0 Document Types XHTML Validation Test Your Knowledge 133 134 136 137 137 140 140 141 141 141 143 143 144 144 145 146 147 148 153 154 155 155 155 156 157 157 158 159 Introduction to MySQL 161 MySQL Basics Summary of Database Terms Accessing MySQL via the Command Line Starting the Command-Line Interface Using the Command-Line Interface MySQL Commands Data Types Indexes Creating an Index Querying a MySQL Database viii | Table of Contents www.it-ebooks.info 161 162 162 163 166 168 172 181 182 187 ... SECOND EDITION Learning PHP, MySQL, JavaScript, and CSS Robin Nixon Beijing • Cambridge • Farnham • Kưln • Sebastopol • Tokyo www.it-ebooks.info Learning PHP, MySQL, JavaScript, and CSS, Second Edition. .. HTTP and HTML: Berners-Lee’s Basics The Request/Response Procedure The Benefits of PHP, MySQL, JavaScript, and CSS Using PHP Using MySQL Using JavaScript Using CSS The Apache Web... the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc Learning PHP, MySQL, JavaScript, and CSS, the image of sugar gliders, and related trade dress are

Ngày đăng: 01/11/2013, 09:57

Từ khóa liên quan

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

Tài liệu liên quan