Home  >  Article  >  Backend Development  >  Introduction to PHP_PHP Tutorial

Introduction to PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 16:01:29813browse

PHP is a server-side scripting language that is easy to learn and use. With very little programming knowledge you can use PHP to build a truly interactive WEB site. This tutorial is not intended to give you a complete understanding of the language, but to get you started developing dynamic web sites as quickly as possible. I assume you have some basic knowledge of HTML (or an HTML editor) and some programming ideas.

1. Introduction

PHP is one of the tools that allows you to generate dynamic web pages. PHP web files are treated as ordinary HTML web files and when editing, you can write PHP in the normal way of editing HTML.

PHP stands for: Hypertext Preprocessor (PHP: Hypertext Preprocessor). PHP is completely free, no need to spend money, you can download it freely from the PHP official site (http://www.php.net). PHP complies with the GNU Public License (GPL), under which many popular software such as Linux and Emacs were born. You have unlimited access to the source code and can even add the features you need. PHP can run on most Unix platforms, GUN/Linux and Microsoft Windows platforms. Information on how to install PHP on a Windows PC or Unix machine can be found on the PHP official site. The installation process is simple.


If your machine solves the 2000 problem, then PHP will also not have the Y2K problem!

1.1 History

Three years ago, Rasmus Lerdorf created Personal Home Page Tools in order to create his online resume. It's a very simple language. Since then, more and more people have noticed this language and made various suggestions for its extension. Through the dedication of many people and the source-free nature of the language itself, it evolved into a feature-rich language that is still growing.

Although PHP is easy to learn, it is slower than mod_perl (the perl module embedded in the web server). There is now a new engine called Zend that is as fast as mod_perl, and PHP4 can take full advantage of this engine. PHP4 is still in the BETA testing stage. Andy Gutmans and Zeev Suraki are Zend's primary authors. You can go to the Zend site (http://www.zend.com) to learn more.

The application of PHP has grown significantly in personal web projects. According to a Netcraft report in October 1999, there were 931,122 domains and 321,128 IP addresses utilizing PHP technology.

1.2 Advances in PHP

There are many benefits to applying PHP. Of course, the known disadvantage is that PHP has no commercial support because it is an open source project, and the resulting slow execution speed (until PHP4). But PHP's mailing list is very useful and unless you're running a very popular site like Yahoo! or Amazon.com, you won't notice any difference in PHP's speed. At least I didn’t feel it! Okay, let's take a look at the advantages of PHP:

- Learning process


I personally prefer PHP's very simple learning process. Unlike Java and Perl, you don't have to bury your head in 100-plus pages of documentation to write a decent program. As long as you understand some basic syntax and language features, you can start your PHP coding journey. If you encounter any trouble later during the coding process, you can read the relevant documents again.

PHP’s syntax is the same as C, Perl, ASP or JSP. For those who are more familiar with one of the above languages, PHP is too simple. On the contrary, if you know more about PHP, then it will be easy for you to learn several other languages.

You only need 30 minutes to master all the core language features of PHP. You may already know HTML very well, and you even know how to use editing and design software or manually to create a good-looking WEB site. Since PHP code can be easily added to your site, when you design and maintain your site, you can easily add PHP to make your site more dynamic.

- Database connection

PHP can be compiled with functions to connect to many databases. PHP and MySQL are an excellent combination right now. You can also write your own peripheral functions to access the database indirectly. In this way, when you change the database you use, you can easily change the coding to adapt to such changes. PHPLIB is the most commonly used series of base libraries that can provide general transaction needs.

- Scalability

As mentioned before, PHP has entered a period of rapid development. It may be difficult for a non-programmer to extend additional functionality to PHP, but it is not difficult for a PHP programmer.

- Object-oriented programming

PHP provides classes and objects. Web-based programming work requires object-oriented programming skills. PHP supports constructors, extracted classes, etc.

- Scalability

Traditionally, the interaction of web pages is achieved through CGI. The scalability of CGI programs is not ideal because it opens a separate process for each running CGI program. The solution is to compile the interpreter of the language commonly used to write CGI programs into your web server (such as mod_perl, JSP). PHP can be installed this way, although few people are willing to install it CGI this way. Embedded PHP can be more scalable.

- More features

In order to be more suitable for web programming, PHP developers have developed many peripheral popular base libraries, which contain easier-to-use layers. You can use PHP to connect to most databases including Oracle, MS-Access, and Mysql. You can draw pictures on flies, write programs to download or display e-mails. You can even complete network-related functions. Best of all, you can choose which features your PHP installation requires. To quote Nissan's Xterra, PHP can do everything you want it to do and it's omnipotent!

1.3 Competitors: ASP, mod_perl, JSP

Of course I don't know What can ASP/JSP do. What is clear though is how easy it would be to write code like that, how expensive it would be to buy them and how expensive and powerful hardware they would require. If you have any neutral views (for example, not influenced by SUN and Microsoft's millions of dollars), please let me know by the way.

As far as I know, JSP is based on Java, so Java programmers can easily start coding. ASP is just a general engine with the ability to support multiple languages, but the default and most commonly used one is VBScript.

mod_perl is as powerful as Perl, just faster.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316825.htmlTechArticlePHP is a server-side scripting language that is easy to learn and use. With very little programming knowledge you can use PHP to build a truly interactive WEB site. This tutorial is not meant to make you complete...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn