Beginning PHP 5.3 phần 1 pptx

85 256 0
Beginning PHP 5.3 phần 1 pptx

Đ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

[...]... Creating Classes and Objects in PHP Creating and Using Properties Understanding Property Visibility Declaring Properties Accessing Properties xviii 12 1 12 1 12 8 13 4 13 6 13 7 13 8 13 9 14 1 14 1 14 2 14 2 14 4 14 5 14 5 14 7 14 8 15 0 15 4 15 8 15 9 16 0 16 0 16 3 16 4 16 5 16 6 16 6 16 7 16 7 16 7 16 8 16 8 16 8 16 9 16 9 17 0 17 0 Contents Static Properties Class Constants 17 2 17 3 Working with Methods 17 4 Method Visibility Creating... Arrays Creating a Multidimensional Array Accessing Elements of Multidimensional Arrays Looping Through Multidimensional Arrays 77 77 78 78 79 79 80 81 81 81 82 87 87 89 89 95 96 96 98 99 10 0 10 1 10 2 10 2 10 3 10 4 10 5 10 7 10 8 10 9 11 3 11 4 11 4 11 5 11 6 11 7 11 8 11 9 xvii Contents Manipulating Arrays Sorting Arrays Adding and Removing Array Elements Merging Arrays Together Converting Between Arrays and Strings... Summary Exercises 17 4 17 4 17 5 17 5 17 5 17 9 18 0 18 2 18 3 18 4 18 7 19 1 19 2 19 6 19 8 19 9 200 204 209 209 210 212 213 215 217 218 Part III: Using PHP in Practice Chapter 9: Handling HTML Forms with PHP 2 21 How HTML Forms Work Capturing Form Data with PHP 222 230 Dealing Securely with Form Data Handling Empty Form Fields 234 234 Dealing with Multi-Value Fields Generating Web Forms with PHP Storing PHP Variables... Run PHP Running PHP with other Web Servers Compiling PHP Yourself Running PHP Remotely Creating Your First Script Embedding PHP within HTML Enhancing the Script Further Using Comments to Make Code More Readable Summary Exercise 3 3 5 7 7 7 8 8 8 9 9 11 12 12 15 17 19 21 22 23 23 24 24 25 28 29 30 30 Contents Part II: Learning the Language Chapter 3: PHP Language Basics Using Variables in PHP Naming Variables... Creating Thumbnails 4 81 487 488 489 490 493 494 497 498 499 500 505 506 507 507 508 508 509 510 510 510 511 512 520 5 21 523 528 Using Text in Images 5 31 Adding Standard Text Using TrueType Fonts 5 31 533 Summary Exercises Chapter 18 : String Matching with Regular Expressions What Is a Regular Expression? Pattern Matching in PHP Exploring Regular Expression Syntax xxiv 536 537 539 540 5 41 542 Contents Matching... Logic Automated Code Testing with PHPUnit Summary Exercises 619 620 6 21 622 623 625 625 630 6 31 632 633 6 41 642 643 644 644 646 647 647 648 6 51 652 660 666 6 71 672 Appendix A: Solutions to Exercises 673 Appendix B: Configuring PHP 719 Appendix C: Alternatives to MySQL 757 Appendix D: Using PHP from the Command Line 765 Index 775 xxvi Introduction Welcome to Beginning PHP 5.3! This book teaches you how... with PHP Chapter 1: Introducing PHP What Is PHP? Why Use PHP? The Evolution of PHP What’s New in PHP 5.3 Namespaces The goto Operator Nowdoc Syntax Shorthand Form of the Ternary Operator Advanced Changes Summary Chapter 2: Your First PHP Script Installing PHP Installing on Ubuntu Linux Installing on Windows Installing on Mac OS X Testing Your Installation Setting Your Time Zone Other Ways to Run PHP. .. Members’ Area Adding an Authentication Method to the Member Class Enhancing the LogEntry Class to Record Page Views xxii 367 367 369 370 370 3 71 3 71 372 373 374 376 377 378 379 3 81 382 385 386 387 388 390 394 395 399 400 4 01 402 403 403 406 407 408 408 409 411 417 417 418 419 Contents Adding More Common Code Writing the Login Page Script Creating a Logout Function Creating the Pages for the Members’ Area Testing... root Password A Quick Play with MySQL 313 314 315 316 318 320 3 21 325 325 328 329 334 335 337 338 338 339 340 3 41 3 41 343 349 349 350 353 Creating a New Database Creating a Table Adding Data to a Table Reading Data from a Table Updating Data in a Table Deleting Data from a Table Deleting Tables and Databases 353 354 356 356 357 358 358 Connecting to MySQL from PHP 359 Making a Connection Handling Errors... Chapter 1 introduces you to PHP You see how PHP compares to other Web programming languages, look at how PHP has evolved over the years, and briefly explore the new features in PHP version 5.3 xxviii Introduction Chapter 2 walks you through installing a copy of the PHP engine on Ubuntu Linux, Windows, and Mac OS X; looks at other ways you can install or use PHP; and shows you how to write a simple PHP . and Strings 13 6 Converting an Array to a List of Variables 13 7 Summary 13 8 Exercises 13 9 Chapter 7: Functions 14 1 What Is a Function? 14 1 Why Functions Are Useful 14 2 Calling Functions 14 2 Working. 7 75 ffirs.indd iffirs.indd i 9/ 21/ 09 7:22:44 PM9/ 21/ 09 7:22:44 PM ffirs.indd iiffirs.indd ii 9/ 21/ 09 7:22: 45 PM9/ 21/ 09 7:22: 45 PM Beginning PHP 5. 3 ffirs.indd iiiffirs.indd iii 9/ 21/ 09 7:22: 45. First PHP Script 11 Installing PHP 12 Installing on Ubuntu Linux 12 Installing on Windows 15 Installing on Mac OS X 17 Testing Your Installation 19 Setting Your Time Zone 21 Other Ways to Run PHP

Ngày đăng: 09/08/2014, 14:21

Từ khóa liên quan

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

Tài liệu liên quan