PHP novice

xiaoxiao2021-03-06  46

PHP Novice (1) Publisher PHP 2004-12-01 15:45 PHP is a server-side scripting language that is easy to learn and use. I only need little programming knowledge you can use PHP to build a virtual interactive Web site. This tutorial does not want you to fully understand this language, just allow you to join the ranks of the development of the dynamic Web site as soon as possible. I assume that you have some basic knowledge of HTML (or HTML editor) and some programming ideas.

1 Introduction

PHP is one of the tools that make you generate a dynamic web page. PHP Representative: Hypertext Pretreatment (PHP: Hypertext Preprocessor). PHP is completely free, don't spend money, you can freely download from the official site (http://www.php.net). PHP complies with GNU Public License (GPL), and many popular software such as Linux and Emacs were born under this license. You can get the source code unrestricted, even you can add the features you need from it. PHP can run on most UNIX platforms, GUN / Linux and Microsoft Windows platforms. How to install PHP on a Windows environment or a UNIX machine can be found on the official site of the PHP, you can also review the "PHP Installation of the PHP Installation" feature article. The installation process is simple.

If your machine solves the 2000 problem, then PHP is the same as the nematode problem!

1.1 history

Three years ago, Rasmus Lerdorf created the Personal Home Page Tools in order to create his online resume. This is a very simple language. Thereafter, more and more people have noticed this language and put forward various recommendations for their expansion. Under the selfless dedication of many people and the source code freedom of this language itself, it has evolved into a characteristic language and is now growing.

Although PHP is easy to learn, the speed is slower than mod_perl (Perl module implanted with the web server). Now there is a new engine called Zend with Mod_Perl, and PHP4 can make full use of this engine. Now, the official version of the PHP4 has been released. You can download it on the official site of PHP. Andy Gutmans and Zeev Suraki are the main author of Zend. You can go to the Zend site (http://www.zend.com) to learn more.

PHP's application has grown significantly in the WEB project of personal nature. According to Netcraft's report in October 1999, there were 93122 domains and 321,128 IP addresses using PHP technology.

1.2 PHP's advanced

There are many benefits to PHP. Of course, it is known that PHP is that it is an open source project, there is no commercial support, and thereby brings slowly (until PHP4). But the php list is very useful and unless you are running like Yahoo! or Amazon.com, you will not feel the speed of PHP and what else is different from others. At the very least, I didn't feel it! Ok, let's take a look at the advantages of PHP:

- learning process

I personally prefer PHP very simple learning process. Unlike Java and Perl, you don't have to work hard to learn from 100 pages of documents to write a similar program. Just learn about some basic grammar and language characteristics, you can start your PHP encoding tour. After you have encountered any trouble during the coding process, you can also go through the relevant documentation.

PHP syntax is similar to C, Perl, ASP, or JSP. For those familiarity familiar to the above language, PHP is too simple. Conversely, if you know more about PHP, then you are very simple to learn from several other languages.

You only need 30 minutes to master all the core language features of PHP. You may have a very understanding of HTML, or you already know how to use editing design software or manual to make a good-looking Web site. Since PHP code is accessible to your site, you can easily add PHP to your site more dynamic characteristics while you can design and maintain your site. - Database Connectivity

PHP can be compiled into a function that is connected to many database. PHP and MySQL are now a great combination. You can also write the peripheral function to take indirect access to the database. By this way When you replace the database, you can easily change the encoding to adapt to this change. PHPLIB is the most commonly used group of base libraries that provide general transactions.

- Scalability

As mentioned earlier, PHP has entered a period of rapid development. For a non-channel, it is more difficult to extend additional functionality for PHP, but it is not difficult for a PHP programmer.

- Object-Oriented Programming

PHP provides classes and objects. Web-based programming work is very important for object-oriented programming capabilities. PHP supports constructors, extraction classes, etc.

- scalability

The interaction of the traditional onpage is achieved by CGI. The scalability of the CGI program is not ideal because it opens an independent process for each running CGI program. The solution is to compile the interpreter that is often used to write the language of the CGI program into your web server (such as MOD_PERL, JSP). PHP can be installed in this way, although few people are willing to install it in a CGI mode. The embedded PHP can have higher scalability.

- More Features

PHP developers have developed many peripheral popular base libraries in order to make Web programming, which contain more easy to use. You can use the PHP connection including most of the databases in Oracle, MS-Access, MySQL. You can draw on flies, write programs to download or display e-mail. You can even complete the network-related functionality. Best, you can choose which features you need for your PHP installation version. Quote Nissan's xterra, that is, PHP can do everything you want to do, it is omnipotent! PHP novice (2) Poster PHP 2004-12-01 15:45 2. Competitor: ASP, MOD_PERL JSP

There are many techniques for implementing interactive dynamic web pages, where CGI is also known as a common gateway interface, is a standard programming interface between external programs and web servers, but the disadvantages of the CGI program are too much; Perl has solved the problem in CGI, which is used to drive complex web technology; Microsoft's ASP (Active Server Pages) appearance, which is easy to get started, easy to write a powerful support backing of the program and micro-software make ASP The child became a petition of professional programmers and non-professional programming personnel; Middle Ware and Allaire's Cold Fusion is another solution, and Cold Fusion has a proven to be reliable search engine components; JSP is a new generation of Sun launched Site development language, etc. There are so many dynamic web technology, maybe you will ask: "Why do I want to choose PHP?"

Let's take a look at the advantages and disadvantages between ASP, PHP, and JSP before answering this issue.

2.1 About ASP

Since its simple features such as simple functions, ASPs, plus MS strong support, can be said to be one of the most popular languages ​​of the site, and he can achieve almost C / S with MS COM technology. All functions that can be implemented can be said to have considerable competitiveness. The ASP code is also very simple. The interdev provided by MS is based on RAD, and the development of ASP has spread all over the north night. However, his disadvantage is that he can only run on the MS platform because MS has a long-term style. Therefore, it is difficult to accept in a critical application. 2.2 About JSP

JSP is a new generation of sites in SUN, which completely solves the current ASP, PHP's common - script level (now PHP4 has also been supported by Zend, realizing compilation and running). SUN company is in Java The extraordinary attainments, add Java from the Java app and the Java Applet, and the new fruit is JSP - Java Server Page. JSP can complete powerful site programs with the support of Serverlet and JavaBean.

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

Which language is better for ASP, JSP, PHP, etc. different people have different opinions. However, there is a little we must be clear: For ASP, JSP, etc., you know how expensive to buy them and how expensive and powerful hardware they need. If you have any neutral point of view (for example, you are not affected by the Million Dollars of Sun and Microsoft), please let me know.

2.3 About PHP

PHP is a GNU style that is Linux, which makes him quickly become one of the most widely used sites in the world. With the form of C , the concept of category is referenced, making the recurrent application of the code simple. In addition, the close cooperation between him and Linux, Apache and MySQL, no problem (famous Sina is PHP). At the same time, the official version of the PHP fourth-generation Zend (PHP4) has also been released, and the core of the entire program has been greatly improved, making the execution speed of the PHP program faster. PHP has a better performance after optimization, has been better than traditional CGI or ASP. And because PHP is free, anyone can access the PHP Web site and download the full source code. More importantly: The code written in PHP will be implemented faster and can implement the same functionality PHP code, without changing, you can run on a different web server, different operating systems. Based on this, you have already had enough reason to choose PHP. PHP Novice (3) Publisher PHP 2004-12-01 15:45 The online tutorial of the PHP site is great. This section of this article will make you familiar with PHP. I can't do any missing, my purpose is to let you start your PHP programming.

3.1 Premiere

You must first have a WEB server that is working on the PHP. I assume that all PHP files on your server are .php3.

3.2 PHP installation

For the installation configuration of PHP, you can consult the "PHP Installation Raiders" feature article on the webpage bar.

3.3 grammar

From the grammar, the PHP language is approximated in the C language. It can be said that PHP is the grammatical characteristics of the C language, which is improved by the C language. We can mix the PHP code and HTML code, not only in the HTML file, we can even embed the HTML tag in the PHP script. The following is a few ways you can use. You can use one of you most suitable and stick this way! Separate from HTML

The following is a method you can use: <"PHP..................................................................................................................................................

Note: When you use "". You can also use script tags like writing other scripting languages, such as "