The page listed above is no more impressive than the plain HTML version listed at the beginning of this chapter. However, passing in different variables will result in the automatic generation of any number of specific pages. In the previous example, the page is to list the books by condition, rather than by the author's last name, so the result is no further. Work. If we add a new book about another company to our database, these examples will automatically update to reflect the new information.
As you can see from these two different original manifests, server-side scripting cannot be viewed from the client. All the important work happens before the source code is sent to the client. After being formed from the web server, the source code appears as plain HTML on the other end. This also means that there is no way to tell which server-side scripting language is used unless it is listed in the header or URL. The scripting is written in PHP and MySQL libraries, and you can learn all about these technologies in Part 2 of this book.
Many tasks and completions can be done either on the client side or on the server side. For example, the client-side method of sending an e-mail is for the client mail application to open an email window with a blank recipient address when the user clicks a mailto button link; but the server-side method allows the user to The form is filled out, its content is formatted as an email, and sent via an SMTP server. You can also choose between client-side and server-side methods for things like browser detection, form validation, drop-down lists, and arithmetic operations. Sometimes, there are subtle but important differences in their functionality (on the server, drop-down lists can be dynamically generated, but not on the client), but this is not always the case.
How to choose? Start by understanding your users. The server-side approach is generally slower in terms of execution time because of the extra transmission, but it does not make any assumptions about the visitor's browser capabilities, and developers will have relatively less time for maintenance. This makes them ideal for general mass market and educational websites. If you can be absolutely certain that your visitors have updated browsers and high access, you can freely script languages and graphics. Finally, remember that you can use PHP to generate static HTML and JavaScript, so that you can take care of both directions. The comparison will be explained in more depth later.
The advantages of server-side scripting
Both the client and the server have their own advantages, but server-side scripting lacks visual appeal in presentation. Most web users interact with the finished product of server-side scripting on a daily, if not hourly, basis.
Things like "making 3D gunfight videos" are things that the server can never help with. The more immediate and graphics-intensive a project requires, the less suitable it is to use PHP to implement it. At the moment, the Web is too slow for these purposes (although the broadband elite are working hard to change that).
On the other hand, the areas where server-side scripting such as PHP can work well on the Web are:
◆ Content websites (including production and display)
◆ Sites with community characteristics (such as forums, publications Column...etc.)
◆ e-mail (Webmail, mail forwarding, sending from Web application)
◆ Customer support and technical support system
◆ Advertising network
◆ Web sending and delivery business application
◆ Directories and membership lists
◆ Surveys, polls and tests
◆ Online filling and form submission
◆ Personalization technology
◆ Group software
◆ Catalogs, brochures and information websites
◆ Basically any other application that needs to connect a back-end server (database, mail, LDAP, etc.) to a Web server.
PHP can handle the basic tasks listed above.
After the above content, readers should now have an understanding of the differences between client and server technologies, and then it’s time to practice. The following chapters will cover how to obtain, install, and configure PHP (or have someone else do this for you).
Due to the recent rapid development of programming languages, the difference between programming and scripting languages has gradually become blurred. For example, PHP itself uses the same control structures as in other programming languages. However, fully literal HTML embedded languages, such as ASP, are still considered to be on the scripting language side, while separately compiled binary code is a more distinctive mark of programming. But because PHP4 is now dynamically compiled (the compiled binary code is saved and reused until the source code is changed), it has officially become a "real" programming language. This change can illustrate the role of PHP4 in A change in speed, it has been lumped into the same category as Perl.
Summary
It's important to know what PHP (or any other server-side scripting language technology) can do and understand the division of work between client and server. In this chapter, we used examples to demonstrate ordinary static HTML, HTML with effects generated by the client (such as Java Script and CCS), and also introduced web pages generated by PHP as seen from the server and client.
Client-side scripting languages are more visually appealing and can respond quickly to user input, but anything beyond the most basic HTKL will suffer depending on the browser. Static user-side scripting also requires developers to spend more time maintaining and updating because pages cannot be automatically generated based on changing data access. Server-side programming and scripting languages, such as PHP, can connect databases and other servers to Web pages.
PHP4 is architecturally different from some other server-side tools, even from PHP3. It is dynamically compileable, which makes it faster to execute. PHP4 even separates the scripting engine (Zend) from the scripting language.
The above is the content of PHP Learning Guide - Chapter 2 (continuation). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!