Thông tin tài liệu
Developing Web Developing Web Applications with PHP Applications with PHP RAD for the World Wide Web Jeff Jirsa jjirsa@xnet.com Agenda Agenda – Introduction – PHP Language Basics – Built-in Functions – PHP on Linux and Windows – Tricks and Tips – PHP 5 – Examples – Questions? Introduction Introduction • What is PHP? – PHP stands for "PHP Hypertext Preprocessor” – An embedded scripting language for HTML like ASP or JSP – A language that combines elements of Perl, C, and Java Introduction Introduction • History of PHP – Created by Rasmus Lerdorf in 1995 for tracking access to his resume – Originally a set of Perl scripts known as the “Personal Home Page” tools – Rewritten in C with database functionality – Added a forms interpreter and released as PHP/FI: includes Perl-like variables, and HTML embedded syntax Introduction Introduction • History of PHP (cont.) – Rewritten again in and released as version 2.0 in November of 1997 – Estimated user base in 1997 is several thousand users and 50,000 web sites served – Rewritten again in late 1997 by Andi Gutmans and Zeev Suraski – More functionality added, database support, protocols and APIs Introduction Introduction • History of PHP (cont.) – User base in 1998 estimated 10,000 users and 100,000 web sites installed – Version 3.0 was released in June 1998 as PHP – Estimated user base in tens of thousands and hundreds of thousands of web sites served Introduction Introduction • History of PHP (cont.) – Rewritten again in 1997 by Andi Gutmans and Zeev Suraski – More functionality added (OOP features), database support, protocols and APIs – PHP 3.0 is released in June 1998 with some OO capability – The core is rewritten in 1998 for improved performance of complex applications Introduction Introduction • History of PHP (cont.) – The core is rewritten in 1998 by Zeev and Andi and dubbed the “Zend Engine” – The engine is introduced in mid 1999 and is released with version 4.0 in May of 2000 – The estimated user base is hundreds of thousands of developers and several million of web sites served Introduction Introduction • History of PHP (cont.) – Version 5.0 will include version 2.0 of the Zend Engine • New object model is more powerful and intuitive • Objects will no longer be passed by value; they now will be passed by reference • Increases performance and makes OOP more attractive Introduction Introduction • Netcraft Statistics – 11,869,645 Domains, 1,316,288 IP Addresses [...]... way to do it • < ?php echo “Hello World!”; ?> • < ?php $greeting = “Hello World!” printf(“%s”, $greeting); php? > PHP Language Basics • Hello World!: An Example (cont.) • $hello = “Hello”; $world = “World!”; print $hello $world PHP Language Basics • Constants, Data Types and Variables – Constants define a string or numeric value – Constants do not begin with a dollar sign... Zdnet Statistics • PHP pumped out about 47 pages/second • Microsoft ASP pumped out about 43 pages/second • Allaire ColdFusion pumped out about 29 pages/second • Sun Java JSP pumped out about 13 pages/second * From PHP HOWTO, July 2001 PHP Language Basics • The Script Tags – All PHP code is contained in one of several script tags: • • < ?php // Some code here ?> PHP Language Basics... on Unix – Session Management Functions PHP on Linux and Windows • Code Portability – The obvious: don’t use Unix or Windows specific functions – Create a reusable module for file system differences, for example: – if( PHP_ OS == "Linux" ) { $ConfigPath = "/var/www/conf"; $DataPath = "/var/www/data"; } PHP on Linux and Windows • Code Portability – if( ereg("WIN", PHP_ OS) ) { $ApachePath = “C:/Program... define(“PI”, 3.14); define(“NL”, “\n”); PHP Language Basics • Constants, Data Types and Variables – Using a constant • print(“Company name: “ COMPANY NL); PHP Language Basics • Constants, Data Types and Variables – Data types • Integers, doubles and strings – – – – – isValid = true; 25 3.14 ‘Four’ “Total value” // Boolean // Integer // Double // String // Another string PHP Language Basics • Constants,... “$city, $state”; – $number = $address + 1; // $number equals 124 PHP Language Basics • Constants, Data Types and Variables – Data types • Arrays – Perl-like syntax • $arr = array("foo" => "bar", 12 => true); – same as • $arr[“foo”] = “bar”; • $arr[12] = true; PHP Language Basics • Constants, Data Types and Variables • Arrays (cont.) – < ?php $arr = array("somearray" => array(6 => 5, 13 => 9, "a" => 42));... Basics • The Script Tags (cont.) • . Developing Web Developing Web Applications with PHP Applications with PHP RAD for the World Wide Web Jeff Jirsa jjirsa@xnet.com Agenda Agenda – Introduction – PHP Language. Basics – Built-in Functions – PHP on Linux and Windows – Tricks and Tips – PHP 5 – Examples – Questions? Introduction Introduction • What is PHP? – PHP stands for " ;PHP Hypertext Preprocessor” – An. * From PHP HOWTO, July 2001 PHP Language Basics PHP Language Basics • The Script Tags – All PHP code is contained in one of several script tags: • <? // Some code ?> • < ?php // Some
Ngày đăng: 23/10/2014, 15:51
Xem thêm: Develop web application with PHP