PHP基础语言外文翻译文献

合集下载

php近三年参考文献

php近三年参考文献

php近三年参考文献在过去的三年里,PHP作为一种流行的服务器端脚本语言,有许多相关的参考文献涉及到了不同方面的内容。

以下是一些可能对你有帮助的参考文献:1. "PHP 7 Programming Blueprints" by Jose Palala and Martin Helmich 这本书介绍了PHP 7的新特性和最佳实践,涵盖了Web开发、数据库集成、安全性等方面。

2. "Modern PHP: New Features and Good Practices" by Josh Lockhart 这本书详细介绍了PHP的现代开发技术,包括命名空间、自动加载、测试等方面。

3. "PHP Objects, Patterns, and Practice" by Matt Zandstra 这本书讲解了PHP面向对象编程的原理和实践,包括设计模式、SOLID原则等内容。

4. "PHP Web Services: APIs for the Modern Web" by Lorna Jane Mitchell 这本书介绍了如何使用PHP构建和消费Web服务,包括RESTful API、SOAP等方面。

5. "PHP and MySQL Web Development" by Luke Welling and Laura Thomson 这本经典的书籍涵盖了PHP和MySQL的基础知识以及如何构建动态Web应用程序。

6. "PHP Solutions: Dynamic Web Design Made Easy" by David Powers 这本书提供了许多实际的示例和解决方案,帮助读者理解和解决PHP开发中的常见问题。

7. "PHP Cookbook" by David Sklar and Adam Trachtenberg 这本书是一个实用的PHP编程指南,提供了大量的代码示例和解决方案,涵盖了各种PHP应用场景。

php毕业设计外文翻译--通过PHP访问MySQL

php毕业设计外文翻译--通过PHP访问MySQL

php毕业设计外文翻译--通过PHP访问MySQLGetting PHP to Talk to MySQLOnce you are familiar with using MySQL client tools to manipulate data in the database。

you can start using PHP to display and modify data from the database。

PHP has standard ns for working with databases。

In this article。

we will discuss PHP's built-in database ns and how to use the PHP n and n Repository (PEAR) database.PHP'XXXPHP has several built-in XXX are easy to use and allow you to connect to a database。

execute queries。

and retrieve data。

Some of the most commonly used XXX:mysqli_connect() - This n is used to connect to a MySQL database.mysqli_query() - This n is used to execute a query on the database.mysqli_fetch_array() - This n is used to retrieve data from a query result.Using PEAR DatabasePEAR is a repository of PHP ns and ns。

It includes a database package that provides a set of classes for working with databases。

php英文翻译

php英文翻译

毕业设计(论文)外文参考资料及译文译文题目:PHP Development HistoryPHP development history—from《Programming PHP》By: ERIC Within the last few years, PHP has grown to be the most widespread web platform in the world, operational in more than a third of the web servers across the globe. PHP's growth is not only quantitative but also qualitative. More and more companies, including Fortune companies, rely on PHP to run their business-critical applications, which creates new jobs and increases the demand for PHP developers. Version 5, due to be released in the very near future, holds an even greater promise.While the complexity of starting off with PHP remains unchanged and very low, the features offered by PHP today enable developers to reach far beyond simple HTML applications. The revised object model allows for large-scale projects to be written efficiently, using standard object-oriented methodologies. New XML support makes PHP the best language available for processing XML and, coupled with new SOAP support, an ideal platform for creating and using Web Services.Many years ago, when Rasmus Lerdorf first started developing PHP/FI. He could not have imagined that his creation would eventually lead to the development of PHP as we know it today, which is being used by millions of people. The first version of “PHP/FI,” called Personal Homepage Tools/Form Interpreter, was a collection of Perl scripts in 1995.One of the basic features was a Perl-like language for handling form submissions, but it lacked many common useful language features, such as for loops.A rewrite came with PHP/FI 2 in 1997, but at that time the development was almost solely handled by Rasmus. After its release in November of that year, Andi Gutmans and Zeev Suraski bumped into PHP/FI while looking for a language to develop an e-commerce solution as a university project.They discovered that PHP/FI was not quite as powerful as it seemed, and its language was lacking many common features. One of the most interesting aspects included the way while loops were implemented. The hand-crafted lexical scanner would go through the script and when it hit the while keyword it would remember itsposition in the file. At the end of the loop, the sought back to the saved position, and the whole loop was reread and re-executed.Zeev and Andi decided to completely rewrite the scripting language. They then teamed up with Rasmus to release PHP 3, and along also came a new name: PHP:Hypertext Preprocessor, to emphasize that PHP was a different product and not only suitable for personal use. Zeev and Andi had also designed and implemented a new extension API. This new API made it possible to easily support additional extensions for performing tasks such as accessing databases, spell checkers and other technologies, which attracted many developers who were not part of the ”core” group to join and contribute to the PHP project. At the time of PHP 3’s release in June 1998, the estimated PHP installed base consisted of about 50,000 domains. PHP 3 sparked the beginning of PHP’s real breakthrough, and was the first version to have an installed base of more than one million domainsIn late 1998, Zeev and Andi looked back at their work in PHP 3 and felt they could have written the scripting language even better, so they started yet another rewrite. While PHP 3 still continuously parsed the scripts while executing them, PHP 4 came with a new paradigm of “compile first, execute later.” The compilation step does not compile PHP scripts into machine code; it instead compiles them into byte code, which is then executed by the Zend Engine(Zend stands for Zeev & Andi), the new heart of PHP 4. Because of this new way of executing scripts, the performance of PHP 4 was much better than that of PHP 3, with only a small amount of backward compatibility breakage.Among other improvements was an improved extension API for better run-time performance, a web server abstraction layer allowing PHP 4 to run on most popular web servers, and lots more. PHP 4 was officially released on May 22, 2002,and today its installed base has surpassed 15 million domains.In PHP 3, the minor version number (the middle digit) was never used, and all versions were numbered as 3.0.x. This changed in PHP 4, and the minor version number was used to denote important changes in the language. The first important change came in PHP 4.1.0,which introduced superglobals ,such as $_GET and $_POST. Superglobals can be accessed from within functions without having to usethe global keyword. This feature was added in order to allow the register_globals INI option to be turned off. register_globals is a feature in PHP which automatically converts input variables like "?foo=bar" in to a PHP variable called $foo. Because many people do not check input variables properly, many applications had security holes, which made it quite easy to circumvent security and authentication code. With the new superglobals in place, on April 22, 2002, PHP 4.2.0 was released with the register_globals turned off by default. PHP 4.3.0, the last significant PHP 4 version, was released on December 27, 2002. This version introduced the Command Line Interface(CLI), a revamped network I/O layer (called streams), and a bundled GD library. Although most of those additions have no real effect on end users, the major version was bumped due to the major changes in PHP’s core.Soon after, the demand for more common object-oriented features increased immensely, and Andi came up with the idea of rewriting the objected-oriented part of the Zend Engine. Zeev and Andi wrote the “Zend Engine II: Feature Overview and Design” document and jumpstarted heated discussions about PHP’s future. Although the basic language has stayed the same, many features were added, dropped, and changed by the time PHP 5 matured. For example, namespaces and multiple inheritance, which were mentioned in the original document, never made it into PHP 5. Multiple inheritance was dropped in favor of interfaces, and namespaces were dropped completely. You can find a full list of new features in Chapter, “What Is New in PHP 5?”PHP 5 is expected to maintain and even increase PHP’s leadership in the web development market. Not only does it revolutionizes PHP’s object-oriented support but it also contains many new features which make it the ultimate web development platform. The rewritten XML functionality in PHP 5 puts it on par with other web technologies in some areas and overtakes them in others, especially due to the new SimpleXML extension which makes it ridiculously easy to manipulate XML documents. In addition, the new SOAP, MySQLi, and variety of other extensions are significant milestones in PHP’s support for additional technologies.As of April 2007, over 20 million Internet domains were hosted on servers with PHP installed, and PHP was recorded as the most popular Apache module. Significant websites are written in PHP including the user-facing portion of Facebook, Wikipedia , PHP can be used to create stand-alone, compiled applications and libraries, it can be used for shell scripting, and the PHP binaries can be called from the command line.As with many scripting languages, PHP scripts are normally kept as human-readable source code, even on production web servers. In this case, PHP scripts will be compiled at runtime by the PHP engine, which increases their execution time. PHP scripts are able to be compiled before runtime using PHP compilers as with other programming languages such as C (the language PHP and its extensions are written in).Code optimizers aim to reduce the computational complexity of the compiled code by reducing its size and making other changes that can reduce the execution time with the overall goal of improving performance. The nature of the PHP compiler is such that there are often opportunities for code optimization, and an example of a code optimizer is the Zend Optimizer PHP extension.Another approach for reducing overhead for high load PHP servers is using PHP accelerators. These can offer significant performance gains by caching the compiled form of a PHP script in shared memory to avoid the overhead of parsing and compiling the code every time the script runs.The National Vulnerability Database stores all vulnerabilities found in computer software. The overall proportion of PHP-related vulnerabilities on the database amounted to: 12% in 2003, 20% in 2004, 28% in 2005, 43% in 2006, 36% in 2007, and 35% in 2008. Most of these PHP-related vulnerabilities can be exploited remotely: they allow hackers to steal or destroy data from data sources linked to the webserver (such as an SQL database), send spam or contribute to DOS attacks using malware, which itself can be installed on the vulnerable servers.These vulnerabilities are caused mostly by not following best practice programming rules: technical security flaws of the language itself or of its corelibraries are not frequent. Recognizing that programmers cannot be trusted, some languages include taint checking to detect automatically the lack of input validation which induces many issues. Such a feature is being developed for PHP. Although it may be included in mainstream PHP in a future release, its inclusion has been rejected several times in the past.Hosting PHP applications on a server requires a careful and constant attention to deal with these security risks. There are advanced protection patches such as Suhosin and Hardening-Patch, especially designed for web hosting environments. Installing PHP as a CGI binary rather than as an Apache module is the preferred method for added security.With respect to securing the code itself, PHP code can be obfuscated to make it difficult to read while remaining functional.Syntax-highlighted PHP code embedded within HTMLPHP only parses code within its delimiters. Anything outside its delimiters is sent directly to the output and is not parsed by PHP. The most common delimiters are <?php and ?>, which are open and close delimiters respectively. <script language="php"> and </script> delimiters are also available. Short tags can be used to start PHP code, <? or <?= (which is used to echo back a string or variable) and the tag to end PHP code, ?>. These tags are commonly used, but like ASP-style tags (<% or <%= and %>), they are less portable as they can be disabled in the PHP configuration. For this reason, the use of short tags and ASP-style tags is discouraged. The purpose of these delimiters is to separate PHP code from non-PHP code, including HTML.PHP发展史—摘自《PHP程序设计》作者:艾瑞克在最近的几年里,PHP已经发展成为世界上最为流行的Web平台,它运行在全球超过三分之一的Web服务器。

PHP英文翻译

PHP英文翻译

英文部分:When Zeev Suraski added the object-oriented syntax back in the days of PHP 3, it was added as "syntactic sugar for accessing collections." The OO model also had support for inheritance and allowed a class (and object) to aggregate both methods and properties, but not much more. When Zeev and Andi Gutmans rewrote the scripting engine for PHP 4, it was a completely new engine; it ran much faster, was more stable, and boasted more features. However, the OO model first introduced in PHP 3 was barely touched.Although the object model had serious limitations, it was used extensively around the world, often in large PHP applications. This impressive use of the OOP paradigm with PHP 4, despite its weaknesses, led to it being the main focus for the PHP 5 release.So, what were some of the limitations in PHP 3 and 4? The biggest limitation (which led to further limitations) was the fact that the copy semantics of objects were the same as for native types. So, how did this actually affect the PHP developer? When assigning a variable (that points to an object) to another variable, a copy of the object would be created. Not only did this impact performance, but it also usually led to obscure behavior and bugs in PHP 4 applications because many developers thought that both variables would point at the same object, which was not the case. The variables were instead pointing at separate copies of the same object. Changing one would not change the other.For example:class Person {var $name;function getName(){return $this->name;}function setName($name){$this->name = $name;}function Person($name){$this->setName($name);}}function changeName($person, $name){$person->setName($name);}$person = new Person("Andi");changeName($person, "Stig");print $person->getName();In PHP 4, this code would print out "Andi". The reason is that we pass the object $person to the changeName() function by-value, and thus, $person is copied and changeName() works on a copy of $person.This behavior is not intuitive, as many developers would expect the Java-like behavior. In Java, variables actually hold a handle (or pointer) to the object, and therefore, when it is copied, only the handle (and not the entire object) is duplicated.There were two kinds of users in PHP 4: the ones who were aware of this problem and the ones who were not. The latter would usually not notice this problem and their code was written in away where it did not really matter if the problem existed. Surely some of these people had sleepless nights trying to track down weird bugs that they could not pinpoint. The former group dealt with this problem by always passing and assigning objects by reference. This would prevent the engine from copying their objects, but it would be a headache because the code included numerous & signs.The old object model not only led to the afore-mentioned problems, but also to fundamental problems that prevented implementing some additional features on top of the existing object model.In PHP 5, the infrastructure of the object model was rewritten to work with object handles. Unless you explicitly clone an object by using the clone keyword, you never create behind-the-scenes duplicates of your objects. In PHP 5, you don't need a need to pass objects by reference or assign them by reference.NotePassing by reference and assigning by reference are still supported, in case you want to actually change a variable's content (whether object or other type).XML support in PHP 4 was implemented using a variety of underlying XML libraries. SAX support was implemented using the old Expat library, XSLT was implemented using the Sablotron library (or using libxml2 via the DOM extension), and DOM was implemented using the more powerful libxml2 library by the GNOME project.Using a variety of libraries did not make PHP 4 excel when it came to XML support. Maintenance was poor, new XML standards were not always supported, performance was not as good as it could have been, and interoperability between the various XML extensions did not exist.In PHP 5, all XML extensions have been rewritten to use the superb libxml2 XML toolkit . It is a feature-rich, highly maintained, and efficient implementation of the XML standards that brings cutting-edge XML technology to PHP.All the afore-mentioned extensions (SAX, DOM, and XSLT) now use libxml2, including the new additional extensions SimpleXML and SOAP.SAXAs previously mentioned, the new SAX implementation has switched from using Expat to libxml2. Although the new extension should be compatible, some small subtle differences might exist. Developers who still want to work with the Expat library can do so by configuring and building PHP accordingly (which is not recommended).DOMAlthough DOM support in PHP 4 was also based on the libxml2 library, it had bugs, memory leaks, and in many cases, the API was not W3C-compliant. The DOM extension went through a thorough facelift for PHP 5. Not only was the extension mostly rewritten, but now, it is also W3C-compliant. For example, function names now use studlyCaps as described by the W3C standard, which makes it easier to read general W3C documentation and implement what you have learned right away in PHP. In addition, the DOM extension now supports three kinds of schemas for XML validation: DTD, XML schema, and RelaxNG.As a result of these changes, PHP 4 code using DOM will not always run in PHP 5. However, in most cases, adjusting the function names to the new standard will probably do the trick.XSLTIn PHP 4, two extensions supported XSL Transformations: the Sablotron extension and the XSLT support in the DOM extension. PHP 5 features a new XSL extension and, as previously mentioned, it is based on the libxml2 extension. As in PHP 5, the XSL Transformation does not take the XSLT stylesheet as a parameter, but depends on the DOM extension to load it. The stylesheet can be cached in memory and may be applied to many documents, which saves execution time.SimpleXMLWhen looking back in a year or two, it will be clear that SimpleXML revolutionized the way PHP developers work with XML files. Instead of having to deal with DOM oreven worseSAX, SimpleXML represents your XML file as a native PHP object. You can read, write, or iterate over your XML file with ease, accessing elements and attributes.Consider the following XML file:<clients><client><name>John Doe</name><account_number>87234838</account_number></client><client><name>Janet Smith</name><account_number>72384329</account_number></client></clients>The following code prints each client's name and account number:$clients = simplexml_load_file('clients.xml');foreach ($clients->client as $client) {print "$client->name has account number $client >account_number\n";}It is obvious how simple SimpleXML really is.In case you need to implement an advanced technique in your SimpleXML object that is not supported in this lightweight extension, you can convert it to a DOM tree by calling it dom_import_simplexml(), manipulate it in DOM, and convert it to SimpleXML using simplexml_import_dom().Thanks to both extensions using the same underlying XML library, switching between them is now a reality.SOAPPHP 4 lacked official native SOAP support. The most commonly used SOAP implementation was PEARs, but because it was implemented entirely in PHP, it could not perform as well as a built-in C extension. Other available C extensions never reached stability and wide adoption and, therefore, were not included in the main PHP 5 distribution.SOAP support in PHP 5 was completely rewritten as a C extension and, although it was only completed at a very late stage in the beta process, it was incorporated into the default distribution because of its thorough implementation of most of the SOAP standard.The following calls SomeFunction() defined in a WSDL file:$client = new SoapClient("some.wsdl");$client->SomeFunction($a, $b, $c);From 《Php 5 Power Programming》翻译:当Zeev Suraski在过去的PHP 3时期增加面对对象语法的时候,面对对象是作为“访问集合的语法甜点”增加进去的。

PHP外文翻译文献

PHP外文翻译文献

PHP外文翻译文献(文档含中英文对照即英文原文和中文翻译)原文:Getting PHP to Talk to MySQlNow that you’re comfortable using the MySQL client tools to manipulate data in the database, you can begin using PHP to display and modify data from the database. PHP has standard functions for working with the database.First, we’re going to discuss PHP’s built-in database functions. We’ll also show you how to use the The PHP Extension and Application Repository (PEAR) databasefunctions that provide the ability to use the same functions to access any supported database. This type of flexibility comes from a process called abstraction. In programming interfaces, abstraction simplifies a complex interaction. It works byremoving any nonessential parts of the interaction, allowing you to concentrate on the important parts. PEAR’s DB classes are one such database interface abstraction. The information you need to log into a database is reduced to the bare minimum. This standard format allows you to interact with MySQL, as well as other databases using the same functions.Similarly, other MySQL-specific functions are replaced with generic ones that know how to talk to many databases. For example, the MySQL-specific connect function is:mysql_connect($db_host, $db_username, $db_password);versus PEAR’s DB connect function:$connection =DB::connect("mysql://$db_username:$db_password@$db_host/$db_database" );The same basic information is present in both commands, but the PEAR function also specifies the type of databases to which to connect. You can connect to MySQL or other supported databases. We’ll discuss both connection methods in detail.In this chapter, you’ll learn how to connect to a MySQL server fromPHP, how to use PHP to access and retrieve stored data, and how to correctly display information to the user.The ProcessThe basic steps of performing a query, whether using the mysql command-line tool or PHP, are the same:• Connect to the database.• Select the database to use.• Build a SELECT statement.• Perform the query.• Display the results.We’ll walk through each of these steps for both plain PHP and PEAR functions.ResourcesWhen connecting to a MySQL database, you will use two new resources. The first is the link identifier that holds all of the information necessary to connect to the database for an active connection. The other resource is the results resource. It contains all information required to retrieve results from an active database query’s result set. You’ll be creating and assigning both resources in this chapter.Querying the Database with PHP FunctionsIn this section, we introduce how to connect to a MySQL database with PHP. It’s quite simple, and we’ll begin shortly with examples, but we should talk briefly about what actually happens. When you try connecting to a MySQL database, the MySQL server authenticates you based on your username and password. PHP handles connectingto the database for you, and it allows you to start performing queries and gathering data immediately.As in Chapter 8, we’ll need the same pieces of information to connect to the database:• The IP address of the database server• The name of the database• The username• The passwordBefore moving on, make sure you can log into your database using the MySQL command-line client.Figure 9-1 shows how the steps of the database interaction relate to the two types of resources. Building the SELECT statement happens before the third function call, but it is not shown. It’s done with plain PHP code, not a MySQL-specific PHP function.Figure 9-1. The interaction between functions and resources when using the databaseIncluding Database Login DetailsYou’re going to create a file to hold the information for logging into MySQL. Storing this information in a file you include is recommended. If you change the database password, there is only one place that you need to change it, regardless of how manyPHP files you have that access the database.You don’t have to worry about anyone directly viewing the file and getting your database login details. The file, if requested by itself, is processed as a PHP file and returns a blank page.Troubleshooting connection errorsOne error you may get is:Fatal error: Call to undefined function mysql_connect( ) in C:\Program Files\ApacheSoftware Foundation\Apache2.2\htdocs\db_test.php on line 4This error occurs because PHP 5.x for Windows was downloaded, and MySQL support was not included by default. To fix this error, copy thephp_mysql.dll file from the ext/ directory of the PHP ZIP file to C:\php, and then C:\WINDOWS\php.ini.Make sure there are two lines that are not commented out by a semicolon (;) at the beginning of the line like these:extension_dir = "c:/PHP/ext/"extension=php_mysql.dllThis will change the extension to include the directory to C:/php and include the MySQL extension, respectively. You can use the Search function of your text editor to check whether the lines are already there and just need to be uncommented, or whether they need to be added completely.You’ll need to restart Apache, and then MySQL support will be enabled. Selecting the DatabaseNow that you’re connected, the next step is to select which database to use with the mysql_select_db command. It takes two parameters: the database name and, optionally, the database connection. If you don’t specify the database connection, the default is the connection from the last mysql_connect:// Select the database$db_select=mysql_select_db($db_database);if (!$db_select){die ("Could not select the database: <br />". mysql_error( ));}Again, it’s good practice to check for an error and display it every time you access the database.Now that you’ve got a good database connection, you’re ready to execute your SQL query.Building the SQL SELECT QueryBuilding a SQL query is as easy as setting a variable to the string that is your SQL query. Of course, you’ll need to use a valid SQL query, or MySQL returns with an error when you execute the query. The variable name $query is used since the name reflects its purpose, but you can choose anything you’d like for a variable name. The SQL query in this example is SELECT * FROM books.You can build up your query in parts using the string concatenate (.) operator:Executing the QueryTo have the database execute the query, use the mysql_query function. It takes two parameters—the query and, optionally, the database link—and returns the result. Save a link to the results in a variable called, you guessed it, $result! This is also a good place to check the return code from mysql_query to make sure that there were no errors in the query string or the database connection by verifying that $result is not FALSE: When the database executes the query, all of the results forma result set. These results correspond to the rows that you saw upon doing a query using the mysql command-line client. To display them, you process each row, one at a time.Fetching and DisplayingUse mysql_fetch_row to get the rows from the result set. Its syntax is: array mysql_fetch_row ( resource $result);It takes the result you stored in $result fromthe query as a parameter. It returns one row at a time from the query until there are no more rows,and then it returns FALSE. Therefore, you do a loop on the result of mysql_fetch_row and define some code to display each row:The columns of the result row are stored in the array and can be accessed one at a time. The variable $result_row[2] accesses the second attribute (as defined in the query’s column order or the column order of the table if SELECT * is used) in the result row.Fetch typesThis is not the only way to fetch the results. Using mysql_fetch_array, PHP can place the results into an array in one step. It takes a result as its first parameter, and the way to bind the results as an optional second parameter. If MYSQL_ASSOC is specified, the results are indexed in an array based on their column names in the query. If MYSQL_NUM is specified, then the number starting at zero accesses the results. The default value, MYSQL_BOTH, returns a result array with both types. The mysql_fetch_assoc is an alternative to supplying the MYSQL_ASSOC argument.Closing the ConnectionAs a rule of thumb, you always want to close a connection to a database when you’redone using it. Closing a database with mysql_close will tell PHP and MySQL that you no longer will be using the connection, and will free any resources and memory allocated to it:mysql_close($connection)InstallingPEAR uses a Package Manager that oversees which PEAR features you install. Whether you need to install the Package Manager depends on which version of PHP you installed. If you’re running PHP 4.3.0 or newer, it’s already installed. If you’rerunning PHP 5.0, PEAR has been split out into a separate package. The DB package that you’re interested in is optional but installed by default with the Package Manager. So if you have the Package Manager, you’re all set.UnixYou can install the Package Manager on a Unix systemby executing the followingfrom the shell (command-line) prompt:lynx -source / | phpThis takes the output of the site (which is actually the source PHP code) to install PEAR and passes it along to the php command for execution.WindowsThe PHP 5 installation includes the PEAR installation script asC:\php\go-pear.bat. In case you didn’t install all the files in Chapter2, go ahead and extract all the PHP files to C:/php from the command prompt, and execute the .bat file.Creating a connect instanceThe DB.php file defines a class of type DB. Refer to Chapter 5 for more information on working with classes and objects. We’ll principally be calling the methods in the class. The DB class has a connect method, which we’ll use instead of our old connect function, mysql_connect. The double colons (::) indicate that we’re calling that function from the class in line 4:$connection =DB::connect("mysql://$db_username:$db_password@$db_host/$db_database" );When you call the connect function, it creates a new database connection that is stored in the variable $connection. The connect function attempts to connect to the database based on the connect string you passed to it. Connect stringThe connect string uses this new format to represent the login information that you already supplied in separate fields:dbtype://username:password@host/databaseThis format may look familiar to you, as it’s very similar to the connect string for a Windows file share. The first part of the string is what really sets the PEAR functions apart fromthe plain PHP. The phptype field specifies the type of database to connect. Supported databases include ibase, msql, mssql, mysql, oci8, odbc, pgsql, and sybase. All that’s required for your PHP page to work with a different type of database is changing the phptype!The username, password, host, and database should be familiar from the basic PHP connect. Only the type of connection is required. However, you’ll usually want to specify all fields.After the values from db_login.php are included, the connect string looks like the following:"mysql://test:test@localhost/test"If the connect method on line 6 was successful, a DB object is created. It contains the methods to access the database as well as all of the information about the state of that database connection.QueryingOne of the methods it contains is called query. The query method works just like PHP’s query function in that it takes a SQL statement. The difference is that the arrow syntax (->) is used to call it fromthe object. It also returns the results as another object instead of a result set: $query = "SELECT * FROM books"$result = $connection->query($query);Based on the SQL query, this code calls the query function fromthe connectionobject and returns a result object named $result.FetchingLine 22 uses the result object to call the fetchRow method. It returns the rows one at a time, similar to mysql_fetch_row:while ($result_row = $result->fetchRow( )) {echo 'Title: '.$result_row[1] . '<br />';echo 'Author: '.$result_row[4] . '<br /> ';echo 'Pages: '.$result_row[2] . '<br /><br />';}Use another while loop to go through each row from fetchRow until it returns FALSE. The code in the loop hasn’t changed from the non-PEAR example.ClosingYou’re finished with the database connection, so close it using the object method disconnect:$connection->disconnect( );PEAR error reportingThe function DB::isError will check to see whether the result that’s been returned to you is an error. If it is an error, you can use DB::errorMessage to return a text description of the error that was generated. You need to pass DB::errorMessage, the return value from your function, as an argument.Here you rewrite the PEAR code to use error checking:<?phpif ( DB::isError( $demoResult = $db->query( $sql))){echo DB::errorMessage($demoResult);} else{while ($demoRow = $demoResult->fetchRow( )){echo $demoRow[2] . '<br />';}}>There’s also a new version of the PEAR database interface called PEAR::MDB2.The same results display, but there are more functions available in this version of the PEAR database abstraction layer.Now that you have a good handle on connecting to the database and the various functions of PEAR。

PHP毕业设计毕业论文外文文献翻译及原文

PHP毕业设计毕业论文外文文献翻译及原文

毕业设计(论文)外文文献翻译文献、资料中文题目:PHP文献、资料英文题目:文献、资料来源:文献、资料发表(出版)日期:院(部):专业:信息工程(电子信息工程方向)班级:姓名:学号:指导教师:翻译日期: 2017.02.14本科毕业设计(论文)外文参考文献译文及原文目录外文参考文献译文1为什么选择PHP (2)2如果你是编程新手 (4)3写一个基本的PHP程序 (4)4编程语法 (8)5嵌入式语言如何工作 (9)6服务端和客户端脚本 (11)7运行你的程序 (13)外文参考文献原文1Why PHP? (14)2If You Are New to Programming (16)3Writing a Basic PHP Program (18)4Programming Syntax (21)5How Embedded Programming Works (24)6Server-side Versus Client-side Scripting (25)7 Running Your New Program (27)1 为什么选择PHP对于Web编程来说,PHP是一个很好的选择。

它较其它语言(包括其它面向Web 的语言)有许多优点。

为了得到一个清晰的理解(和常见的面向Web的语言相比),让我们将它们比较一下。

ASP是微软的网络开发环境(它本身不是一门开发语言,因为它允许程序员在ASP 中选择其它语言进行开发,如VBScript或JScript。

)ASP虽然简单,但它太过于简单了,以至于不能使用更复杂的逻辑和算法。

除了ASP的过分简单,很多公司发现很难在微软的ASP许可证上节约成本。

即使不考虑硬件成本,微软的Web服务器就要数千美元,而基于UNIX操作系统的、可运行PHP的Web服务器则是免费的。

另一种Web使用的知名语言是Sun Microsystems公司的Java。

Java是平台独立的语言(在一个系统上用Java开发的程序可以不经过任何修改,就可以运行在其它系统上)。

PHP相关外文翻译

PHP相关外文翻译

中文5915字,3600单词,17000英文字符本科毕业设计(论文)外文参考文献译文及原文学院信息工程学院专业信息工程(电子信息工程方向) 年级班别学号学生姓名指导教师目录外文参考文献译文1为什么选择PHP ......................................... 错误!未定义书签。

2如果你是编程新手 ...................................... 错误!未定义书签。

3写一个基本的PHP程序 .................................. 错误!未定义书签。

4编程语法 .............................................. 错误!未定义书签。

5嵌入式语言如何工作 .................................... 错误!未定义书签。

6服务端和客户端脚本 .................................... 错误!未定义书签。

7运行你的程序 .......................................... 错误!未定义书签。

外文参考文献原文1Why PHP? ............................................... 错误!未定义书签。

2If You Are New to Programming .......................... 错误!未定义书签。

3Writing a Basic PHP Program ............................ 错误!未定义书签。

4Programming Syntax ..................................... 错误!未定义书签。

5How Embedded Programming Works ......................... 错误!未定义书签。

ASP外文翻译+原文

ASP外文翻译+原文

ASP Banner Ad SystemTo the Reader from Joe: This is a user-submitted tutorial by the author above. I have read the tutorial and set the format to fit HTML Goodies, but for the most part have not changed the language. I chose this tutorial because many readers have been asking for more ASP tutorials. This is a great one.Sorry I cannot show you the event here. The HTML Goodies servers do not offer ASP. I will tell you though that if you run IE5.0 or better, open the contents of the zip file into a directory and it runs just fine.If you haven't already, you may want to read my introductory ASP tutorial before this one. If not, then enjoy.There may be a point in your web design career, where your site becomes real popular. That is when companies become interested in advertising on your site. A Banner Ad system can be built to control all those advertisements that you are so willing to display, for a price. Active Server Pages makes it very easy to create a banner ad system. So easy, that the Microsoft ASP developers created an "AdRotator" component for the occasion. Before you begin reading this article, make sure you download the support material below.The files included aread.txtbanner.asp3 banner imagesclicks.aspexample.aspredirect.aspad.txtIn order for the AdRotator component to work, you must configure a text file. This text file contains all the banner ad properties. However, The text file must follow a certain format. The first four lines are as follows:REDIRECT redirect.aspWIDTH 400HEIGHT 50*REDIRECTWhen a banner is clicked, the "AdRotator" component goes to a preliminary page. This page is called a redirect page. The redirect page handles any extra programming events before directing a user to the banners destination. In this example banner system, I called the preliminary file "redirect.asp".WIDTHThis sets the width of the banner ad image. The value must be in pixels.HEIGHTThis sets the height of the banner ad image. The value must be in pixels.*The asterisk tells the "AdRotator" component that it is about to acquire banner ad information. The asterisk is required.Once you define the general properties above the asterisk, then comes the list of banners to display. In the ad.txt file, there are three banners defined below the asterisk.banner1.jpg20banner2.jpg30banner3.jpg30Each banner requires four lines of properties, which follow the format below:Image filenameWeb AddressDescriptionBanner WeightImage FileThe image filename can be a fully qualified web address or relative name that points to the image. If the image is in a different folder, then you also include the folder name as well.(/banner1.jpg, banner1.jpg, or foldername/banner.jpg)>Web AddressThe web address can be a page on your site or a fully qualified web address that leads to another site.DescriptionThe description will be displayed as a tool tip. When you rest your mouse over the banner, the description pops up.Banner WeightThe banner weight determines how much a banner is displayed. The "AdRotator" component adds all of the banner weights and determines theprobability or percent chance of a particular banner being displayed. A banner with a higher weight has better a better probability.NOTE: You can disable a banners property by substituting with a dash. banner3.jpg-30The example entry above would create a banner ad that does not have a web address.Banner.aspThis file uses the "AdRotator" component and analyzes the contents of the ad.txt file. Below is the code.sub banner(strTarget)dim bannerad, htmlset bannerad = server.CreateObject("MSWC.adrotator")bannerad.TargetFrame = strTargethtml = bannerad.GetAdvertisement("ad.txt")Response.Write htmlend subThe first thing to note is that the ASP was written with VBScript. The second thing to note is that the code is written inside a sub procedure called banner(strTarget).For those of you who do not know, a sub procedure allows you to group together a bunch of code that can be reused over and over. Like a function, it takes an argument, such as a word or variable. In the code above the argument is strTarget.Unlike a function, a sub-procedure does not return any values, it just executes the code inside line by line.Inside the sub I declare two variables...dim bannerad, htmlNext I store the "AdRotator" component inside the "bannerad" variable. When storing a component inside a variable you use the set keyword. Since we are programming server-side with ASP, we use server.CreateObject to summon the component. "MSWC.adrotator" is the component key or name value.set bannerad = server.CreateObject("MSWC.adrotator")Next I use a property of the "AdRotator" called "TargetFrame". This property is equivalent to:html = bannerad.GetAdvertisement("ad.txt")Finally, I want to print the contents of the "html" variable. This prints the code that displays the banner images.Response.Write htmlRedirect.aspThis is the file that is processed before someone is redirected to the banners web address. Inside this file, we can capture information like how many times a particular banner is clicked and so on. To start things off, I defined a variable called "strUrl".Dim strUrlNext I store a querystring value inside this new variable.strUrl = Request.Querystring("url")A querystring is nothing more than a bunch of name/value pairs attached to a web address. When a user clicks on a banner, the "AdRotator" component attaches a querystring to the redirect file. So if we were to click banner1.jpg, defined in ad.txt, we would end up with a redirect web address that looks like so.Redirect.asp?url=&image=banner1.jpgIn essence assigning "Request.Querystring("url") to "strUrl", is the same as assigning to it.Finally, I check to see which banner was clicked. I accomplish this with the VBSCript inStr( ) function.if instr(strUrl, "htmlgoodies") thenApplication.Lockapplication("htmlgoodies") = application("htmlgoodies") + 1Application.UnLockResponse.ClearResponse.Redirect strUrlend ifThe inStr( ) function returns the number position of a sub-word (sub-string) within another word (string). The format is as followsInStr(main word, sub-word)If the sub-word exist within the main word, then the function will equal a number greater-than zero or true. If the sub-word does not exist, then the function will equal zero or false. In the example above, I check to see if "htmlgoodies" exist within . Since the answer is true, then the code inside the if... then... statement will execute.Inside the if... then... I use an application variable. An application variable is native to ASP. Application variables store information as long as a web application exist, a web application ceases to exist when say someone shuts off the web hosting server. The beauty of an application variable is that you can define it on one web page and use it in other web pages within your web application. The downfall is that the users computer must have cookies enabled.Anyways, the code adds one to the application variable, every time a banner is clicked. After one is added, the code redirects to the banners web page. So if banner1 was clicked then you shall be redirected to "".Response.Redirect strUrlExample.aspThis is an example page that uses the banner ad system. When you refresh the page, you should most likely see a different banner. Whenever you want to insert the banner ad on a page, you can use the SSI directive below...<!-- #include file="banner.asp" -->Once you include the file above, then you can call the sub-procedure inside the banner.asp file like so...Call banner("_blank")Notice that I supply one of the values for the "TargetFrame" as an argument. So if the banner is clicked, then the web page should open up in a separate browser window.Clicks.aspThis is a very simple page that displays the number of clicks per banner ad. To display the number of times a banner was clicked, you just print the contents of the application variables that were created inside "redirect.asp". Pretty nifty. <% =application("htmlgoodies") %>ASP横幅广告系统乔给读者的话:这是一个由用户提交上述笔者的教程。

php、mysql主要参考文献

php、mysql主要参考文献

php、mysql主要参考文献以下是一些关于PHP和MySQL的主要参考文献:1. "PHP and MySQL Web Development" by Luke Welling and Laura Thomson - 这本书是学习PHP和MySQL的经典指南,涵盖了从基础到高级的内容。

2. "Learning PHP, MySQL & JavaScript" by Robin Nixon - 这本书提供了一个全面的入门指南,涵盖了PHP、MySQL和JavaScript的基础知识。

3. "PHP Cookbook" by David Sklar and Adam Trachtenberg - 这本书是一本实用的参考书,提供了大量的PHP编程示例和解决方案。

4. "MySQL Explained: Your Step-by-Step Guide" by Andrew Comeau - 这本书解释了MySQL数据库的基本概念和操作,适合初学者。

5. "High Performance MySQL: Optimization, Backups, and Replication" by Baron Schwartz, Peter Zaitsev, and Vadim Tkachenko - 这本书讲解了如何优化、备份和复制MySQL数据库,适合有经验的开发人员。

6. "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide" by Larry Ullman - 这本书提供了一个简洁的指南,教你如何使用PHP 和MySQL构建动态网站。

这些参考文献将为你提供关于PHP和MySQL的广泛知识,并帮助你更好地理解和应用它们。

外文摘要

外文摘要

Security Analysis of PHP EncoderAbstractAs an open source server-side scripts language, PHP is used more and more widely by Web developers now. Protecting PHP code from being plagiarized is also a hot research issue especially with the rapid development of dynamic web industry and people’s copyright protection consciousness. Usually the developers use PHP encoders to encrypt the PHP codes before selling them out. There are several different kinds of PHP encoders with different performances. In this paper, we analyze and compare the security level of some well-known encoders. From a fully new aspect, we try to analyze the output of the encoders with the random statistical tests, which is never done before. Also, we demonstrate the soundness of our method. We figure out the test suite which is most suitable for PHP encoders and explain the reasons. Finally, we carry out the experiments and draw a conclusion about the security of the PHP encoders based on our results作为一个开放源码的服务器端脚本语言,PHP现在越来越被Web开发人员广泛的应用。

计算机网络技术中英文对照外文翻译文献

计算机网络技术中英文对照外文翻译文献

中英文资料外文翻译网站建设技术1.介绍网络技术的发展,为今天全球性的信息交流与资在建立源共享和交往提供了更多的途径和可能。

足不出户便可以知晓天下大事,按几下键盘或点几下鼠标可以与远在千里之外的朋友交流,网上通信、网上浏览、网上交互、网上电子商务已成为现代人们生活的一部分。

Internet 时代, 造就了人们新的工作和生活方式,其互联性、开放性和共享信息的模式,打破了传统信息传播方式的重重壁垒,为人们带来了新的机遇。

随着计算机和信息时代的到来,人类社会前进的脚步在逐渐加快。

近几年网页设计发展,快得人目不暇接。

随着网页设计技术的发展,丰富多彩的网页成为网上一道亮丽的风景线。

要想设计美观实用的网页就应该深入掌握网站建设技术。

在建立网站时,我们分析了网站建立的目的、内容、功能、结构,应用了更多的网页设计技术。

2、网站的定义2.1 如何定义网站确定网站的任务和目标,是建设网站所面临的最重要的问题。

为什么人们会来到你的网站? 你有独特的服务吗? 人们第一次到你的网站是为了什么? 他们还会再来吗? 这些问题都是定义网站时必须考虑的问题。

要定义网站,首先,必须对整个网站有一个清晰认识,弄清到底要设计什么、主要的目的与任务、如何对任务进行组织与规划。

其次,保持网站的高品质。

在众多网站的激烈竞争中,高品质的产品是长期竞争的最大优势。

一个优秀的网站应具备:(1)用户访问网站的速度要快;(2)注意反馈与更新。

及时更新网站内容、及时反馈用户的要求;(3)首页设计要合理。

首页给访问者留下的第一印象很重要,设计务必精美,以求产生良好的视觉效果。

2.2 网站的内容和功能在网站的内容方面,就是要做到新、快、全三面。

网站内容的类型包括静态的、动态的、功能的和事物处理的。

确定网站的内容是根据网站的性质决定的,在设计政府网站、商业网站、科普性网站、公司介绍网站、教学交流网站等的内容和风格时各有不同。

我们建立的网站同这些类型的网站性质均不相同。

PHP中英文介绍

PHP中英文介绍

PHPPHP的(递归的缩写,代表“PHP:Hypertext Preprocessor”的)是一种被广泛使用的开放源代码多用途脚本语言,特别适合于Web开发,可嵌入到HTML中。

简单的答案,但到底是什么意思呢?一个例子:例1.1。

一个简单的例子<html><head><title>举例</title></head><body><?phpecho "Hi, 这是一个PHP程序!";></body></html>请注意这是不同于如Perl或C等语言编写的脚本,而不是编写大量的指令来输出HTML,你写了一个内嵌了代码的HTML脚本做一些事情(在这种情况下,输出一些文本)。

PHP代码包含在特殊的开始和结束标记,让您可以随时进出“PHP模式”。

什么区别时,PHP等客户端JavaScript的代码是在服务器上执行。

如果你有一个类似的脚本在您的服务器上面,客户端将收到的运行的脚本的结果,但没有确定什么底层代码可能是这样。

您甚至可以配置Web服务器来处理所有的与PHP的HTML文件,然后确实没有办法,用户就可以知道你有你的袖口。

使用PHP的最好的事情是,它是对于初学者来说极其简单,但提供了一个专业的程序员许多先进的功能。

不要害怕看到PHP长长的功能清单。

你可以在跳跃,在很短的时间,并开始编写一些简单的脚本。

PHP是一种反射编程语言最初是为制作动态网页设计。

PHP是主要用于服务器端脚本,但可以从一个命令行界面或独立的图形应用。

文字上的用户界面也可以创建使用ncurses 的。

主要的执行是由该PHP集团下的PHP许可证发布。

它被认为是由自由软件基金会自由软件。

这个实现服务定义一个PHP的事实上的标准,因为没有正式的规范。

历史PHP被写为一个CGI二进制执行文件的C编程语言设立的丹麦/格陵兰程序员拉斯穆斯Lerdorf在1994年,以取代一个Perl脚本,他一直使用维护自己的网页一小部分。

php和mysql web开发外文翻译 (2)

php和mysql web开发外文翻译 (2)

外文翻译-原文部分Laura Thomson php and mysql web develop PHP is a scripting language originally designed for producing dynamic web pages It has evolved to include a command line interface capability and can be used in standalone graphical applications.While PHP was originally created by Rasmus Lerdorf in 1995, the main implementation of PHP is now produced by The PHP Group and serves as the de facto standiird for PHP as there is no formal specification. PHP is free software released under the PHP License, however it is incompatible with the GNU General Public License (GPL), due to restrictions on the usage of the term PHP.PHP is a widely-used general-purpose scripting language that is especially suited for web development and can be embedded into HTML. It generally runs on a web server, taking PHP code as its input and creating web pages as output. It can be million websites and 1 million web servers.PHP originally stood for Personal Home Page, It began in 1994 as a set of Common Gateway Interface binaries written in the C programming language by the Danish/Greenlandic programmer Rasmus Lerdorf. Lerdorf initially created these Personal Home Page Tools to replace a small set of Perl scripts he had been using to maintain his personal homepage. The tools were used to perform tasks such as displaying his rdsum^ and recording how much traffic his page was receiving. He combined these binaries with his Fonn Interpreter to create PHP/FI, which had more functionality. PHP/FI included a larger implementation for the C programming language and could communicate with databases, enabling the building of simple, dynamic web applications. lerdorf released PHP publicly on June 8,1995 to accelerate bug location and improve the code.This release was named PHP version 2 and already had the basic functionality that PHP has today. This included Perl-like variables, form handling, and the ability to embed HTML. The syntax was similar to Perl but was more limited, simpler, and less consistent.Zeev Suraski and Andi Gutmans,two Israeli developers at the Technion IIT,rewrote the parser in 1997 and formed the base of PHP 3, changing the language's name to the recursive initialism PHP: Hypertext Preprocessor. The development team officially released PHP/FI 2 in November 1997 after months of beta testing. Afterwards, public testing of PHP 3 began, and the official launch came in June 1998. wSuraski and Gutmans then started a new rewrite of PHP's core, producing the Zend Engine in 1999. They also founded Zend Technologies in Ramat Gan, Israel.On May 22, 2000, PHP 4, powered by the Zend Engine 1 •0, was released. On July 13, 2004, PHP 5 was released, powered by the new Zend Engine II. PHP 5 included new features such as improved support for object-oriented programming, the PHP DataObjects extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements. The most recent update released by The PHP Group is for the older PHP version 4 code branch. As of August, 2008 this branch is up to version 4.4.9. PHP 4 is no longer under development nor will any security updates be released.In 2008, PHP 5 became the only stable version under development. Late static binding has been missing from PHP and will be added in version 5.3. PHP 6 is under development alongside PHP 5. Major changes include the removal of register_globals,magic quotes, and safe mode. The reason for the removals was because register_globals had given way to security holes,and magic quotes had an unpredictable nature, and was best avoided. Instead, to escape characters, magic quotes may be substituted with the addslashes() function, or more appropriately an escape mechanism specific to the database vendor itself like mysql_rcal_escape_string() for MySQL.PHP does not have complete native support for Unicode or multibyte strings; Unicode support will be included in PHP 6. Many high profile open source projects ceased to support PHP 4 in new code as of February 5, 2008, due to the Go PHP 5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 1397 It runs in both 32-bit and 64-bit environments, but on Windows the only official distribution is 32-bit, requiring Windows 32-bit compatibility mode to be enabled while using IIS in a 64-bit Windows environment. There is a third-partydistribution available for 64-bit Windows.PHP is a general-purpose scripting language that is especially suited for web development. PHP generally runs on a web server, taking PHP code as its input and creating web pages as output. It can also be used for command-line scripting and client-side GUI applications. PHP can be deployed on most web servers, many operating systems and platforms, and can be used with many relational database management systems. It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.PHP primarily acts as a filter, taking input from a file or stream containing text and/or PHP instructions and outputs another stream of data; most commonly the output will be HTML. It can automatically detect the language of the user. From PHP 4, the PHP parser compiles input to produce bylecode for processing by the Zend Engine, giving improved performance over its interpreter predecessor.Originally designed to create dynamic web pages,PHP’s principal focus is server-side scripting, and it is similar to other server-side scripting languages that provide dynamic content from a web server to a client, such as Microsoft’s Active Server Pages, Sun Microsystems1 JavaServer Pages, and mod_perl. PHP has also attracted the development of many frameworks that provide building blocks and a design structure to promote rapid application development (RAD). Some of these include CakePHP, Symfony, Codeigniter, and Zend Framework, offering features similar to other web application frameworks-The LAMP architecture has become popular in the web industry as a way of deploying vveb applications. PHP is commonly used as the P in this bundle alongside Linux, Apache and MySQL, although the P may also refer to Python or Perl.As of April 2007, over 20 million Internet domains were hosted on servers with PHP installed, and PHP was recorded as the most popular Apache module. Significant websites arc written in PHP including the user-facing portion of Faccbook, Wikipedia , PHP can be used to create stand-alone, compiled applications and libraries, it can be used for shell scripting, and the PHP binaries can be called from the command line.As with many scripting languages,PHP scripts are normally kept as human-readable source code, even on production web servers. In this case, PHPscripts will he compiled at runtime by the PHP engine, which increases their execution time. PHP scripts are able to be compiled before runtime using PHP compilers as with other programming languages such as C (the language PHP and its extensions are written in).Code optimizers aim to reduce the computational complexity of the compiled code by reducing its size and making other changes that can reduce the execution time with the overall goal of improving performance. The nature of the PHP compiler is such that there are often opportunities for code optimization, and an example of a code optimizer is the Zend Optimizer PHP extension.Another approach for reducing overhead for high load PHP servers is using PHP accelerators. These can offer significant performance gains by caching the compiled form of a PHP script in shared memory to avoid the overhead of parsing and compiling the code every time the script runs.The National Vulnerability Database stores all vulnerabilities found in computer software. The overall proportion of PHP-related vulnerabilities on the database amounted to: 12% in 2003, 20% in 2004, 28% in 2005, 43% in 2006, 36% in 2007, and 35% in 2008. Most of these PHP-related vulnerabilities can be exploited remotely: they allow hackers to steal or destroy data from data sources linked to the Webserver (such as an SQL database),send spam or contribute to DOS attacks using malware,which itself can be installed on the vulnerable servers.These vulnerabilities arc caused mostly by not following best practice programming rules: technical security flaws of the language itself or of its core libraries are not frequent. Recognizing that programmers cannot be trusted, some languages include taint checking to detect automatically the lack of input validation which induces many issues. Such a feature is being developed for PHP. Allhough it may be included in mainstream PHP in a future release, its inclusion has been rejected several times in the past.Hosting PHP applications on a server requires a careful and constant attention to deal with these security risks. There are advanced protection patches such as vSuhosin and Hardening-Patch, especially designed for web hosting environments. Installing PHP as a CGI binary rather than as an Apache module is the preferred method foradded security.With respect to securing the code itself, PHP code can be obfuscated to make it difficult to read while remaining functional.Syntax-highlighted PHP code embedded within HTMLPHP only parses code within its delimiters. Anything outside its delimiters is sent directly to the output and is not parsed by PHP. The most common delimiters are <?php and ?>, which are open and close delimiters respectively.〈script language="php"> and </script> delimiters are also available. Short tags can be used to start PHP code, <? or <?= (which is used to echo back a string or variable) and the tag to end PHP code, ?>. These tags arc commonly used,but like ASP-style tags (<% or <%= and %>),they are less portable as they can be disabled in the PHP configuration. For this reason, the use of short tags and ASP-style tags is discouraged. The puipose of these delimiters is to separate PHP code from non-PHP code,including HTML.Variables arc prefixed with a dollar symbol and a type docs not need to be specified in advance. Unlike function and class names, variable names are case sensitive. Both double-quoted (“”) and heredoc strings allow the ability to embed a variable's value into the string. PHP treats newlines as whitespace in the manner of a free-form language (except when inside string quotes), and statements are terminated by a semicolon. PHP has three types of comment syntax: /* */ serves as block comments, and // as well as # are used for inline comments. The echo statement is one of several facilities PHP provides to output text (e.g. to a web browser).In terms of keywords and language syntax, PHP is similar to most high level languages that follow the C style syntax. If conditions, for and while loops, and function returns arc similar in syntax to languages such as C, C++, Java and Perl.PHP stores whole numbers in a platform-dependent range. This range is typically that of 32-bit signed integers. Unsigned integers are converted values in certain situations; this behavior is different from other programming languages.Integer variables can be assigned using decimal (positive and negative), octal, and hexadecimal notations- Floating point numbers arc also stored in a platform-specific range. They can be specified using floating point notation, or two forms of scientific notation. PHP has a native Boolean type that is similar to the native Boolean types inJava and C++. Using the Boolean type conversion rules,non-zero values are interpreted as true and zero as false, as in Perl and C++.The null dala type represents a variable that has no value. The only value in the null data type is NULL. Variables of the nresourceM type represent references to resources from external sources. These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examples include file, image, and database resources. Arrays can conlain elements of any type thal PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in hashes with both keys and values, and the two can be intermingled. PHP also supports strings, which can be used with single quotes, double quotes, or heredoc syntax.The Standard PHP Library (SPL) attempts to solve standard problems and implemenls efficient data access interfaces and classes.PHP has hundreds of base functions and thousands more via extensions. These functions are well documented on the PHP site, but unfortunately, the built-in library has a wide variety of naming conventions and inconsistencies. PHP currently has no functions for thread programming.Functions are not first-class functions and can only be referenced by their name—directly or dynamically by a variable containing the name of the function.User-defined functions can be created at any time without being prototyped. Functions can be defined inside code blocks, permitting a run-time decision as to whether or not a function should be defined. Function calls must use parentheses, with the exception of zero argument class constructor functions called with the PHP new operator, where parentheses are optional. PHP supports quasi-anonymous functions through the create_function() function, although they are not true anonymous functions because anonymous functions are nameless, but functions can only be referenced by name, or indirectly through a variable $runction_name(); in PHP.PHP gained support for first-class functions and closures. True anonymous functions are supported using the following syntax:function getAdder($x){return function ($y) use ($x) {return $x + $y;};}Sadder = getAdder(8);echo $adder(2); // prints ”10"Here, gctAddcr() function creates a closure using parameter $x (keyword “use” forces getting variable from context), which, etc. For more details see Lambda functions and closures RFC.Basic object-oriented programming functionality was added in PHP 3 and improved in PHP 4.|3| Object handling was completely rewritten for PHP 5, expanding the feature set and enhancing performance. In previous versions of PHP, objects were handled like primitive types. The drawback of this method was that the whole object was copied when a variable was assigned or passed as a parameter to a method. In the new approach, objects are referenced by handle, and not by value. PHP 5 introduced private and protecled member variables and methods, along with abstract classes and final classes as well as abstract methods and final methods. It also introduced a standard way of declaring constructors and destructors, similar to that of other object-oriented languages such as C++, and a standard exception handling model. Furthermore, PHP 5 added interfaces and allowed for multiple interfaces to be implemented. There are special interfaces that allow objects to interact with the runtime system. Objects implementing ArrayAcccss can be used with array syntax and objects implementing Iterator or IteratorAggregate can be used with the foreach language construct. There is no virtual table feature in the engine, so static variables are bound with a name instead of a reference at compile time.If the developer creates a copy of an object using the reserved word clone, the Zend engine will check if a _clonc() method has been defined or not. If not, it will call a default _clone() which will copy the object's properties. If a _clone() method is defined, then it will be responsible for setting the necessary properties in the created object. For convenience, the engine will supply a function that imports the properties of the source object, so that the programmer can start with a by-value replica of thesource object and only override properties that need to be changed.PHP includes free and open source libraries with the core build. PHP is a fundamentally Internet-aware system with modules built in for accessing.FTP servers, many database servers, embedded SQL libraries such as embedded PostgreSQL, MySQL and SQLite, LDAP servers, and others. Many functions familiar to C programmers such as those in the stdio family are available in the standard PHP build. PHP has traditionally used features such as ’’magic_quotes_gpc” and “magic_quotcs_runti me” whic h attempt to escape apostrophes (‘) and quotes (‘’) in strings in the assumption that they will be used in databases, to prevent SQL injection attacks. This leads to confusion over which data is escaped and which is not, and to problems when data is not in fact used as input to a database and when the escaping used is not completely correct.|68| To make code portable between servers which do and do not use magic quotes, developers can preface their code with a script to reverse the effect of magic quotes when it is applied.PHP allows developers to write extensions in C to add functionality to the PHP language. These can then be compiled into PHP or loaded dynamically at runtime. Extensions have been written to add support for the Windows API, process management on Unix-likc operating systems, multibytc strings (Unicode), cURL, and several popular compression formats. Some more unusual features include integration with Internet Relay Chat, dynamic generation of images and Adobe Flash content, and even speech synthesis. The PHP Extension Community Library (PECL) project is a repository for extensions to the PHP language.Zend provides a certification exam for programmers to become certified PHP developers.外文翻译-译文部分php和mysql web开发PHP是最初设计用于生成动态网页的脚本语言,它已经演变成包括命令行界面功能,可以在独立的图形应用程序中使用。

设置PHP开发环境外文翻译(绿皮书)

设置PHP开发环境外文翻译(绿皮书)

设置PHP开发环境外文翻译(绿皮书)大连交通大学2013届本科生毕业设计(论文)外文翻译外文原文Setting Up the PHP Development EnvironmentGetting a working development environment put together can be intimidating, especially for the absolute beginner.To follow along with the project in this boo k, you’ll need to have access to a workinginstallation of Apache, PHP, and MySQL, preferably on your local machine. It’s alwaysdesirable to test locally, both for speed and security. Doing this both shelters your work-in-progress from the open Internet and decreases the amount of time spent uploading files to an FTP server and waitingfor pages to reload.Why You Need Apache, MySQL, and PHPPHP is a powerful scripting language that can be run by itself inthe command line of any computer with PHP installed. However, PHP alone isn't enough in order to build dynamic web sites. To use PHP on a web site, you need a server that can process PHP scripts. Apache is a free web server that, once installed on a computer, allows developers to test PHP scripts locally; this makes it an invaluable piece of your local development environment.Additionally, dynamic websites are dependent on stored information that can be modified quickly and easily; this is the main difference between a dynamic site and a static HTML site. However, PHP doesn’t provide a simple, efficient way to store data. This is wherea relational database management system like MySQL comes into play. This book’s examples rely on MySQL; I chose this database because PHP provides native support for it and the database is free, open-source project.It runs in both 32-bit and 64-bit environments, but on Windows the only official distribution is 32-bit, requiring Windows 32-bit compatibility mode to be enabled while using IIS in a 64-bit Windows environment. There is a third-party distribution available for 64-bit Windows. PHP is a general-purpose scripting language that is especially suited for web development. PHP generally runs on a web server, taking PHP code as its input and creating web pages as output. It can also be used for command-line scripting and client-side GUI applications. PHP can be deployed on most web servers, many operating systems and platforms, and can be used with many relational database management systems. It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use. PHP primarily acts as a filter, taking input from a file1大连交通大学2013届本科生毕业设计(论文)外文翻译or stream containing text and/or PHP instructions and outputsanother stream of data; most commonly the output will be HTML. It can automatically detect the language of the user. From PHP 4, the PHP parser compiles input to produce byte code for processing by the Zend Engine, giving improved performance over its interpreter predecessor At the time I write this, PHP 5.2.9 is the latest stable release available, but versions 5.3 and 6 are both scheduled for release in the near future. PHP 4 is still in use on a number of servers, but support has been discontinued. Many hosting companies let developer use either PHP 4 or PHP 5 on their sites.PHP OriginPHP originally stood for “Personal Home Page” and was released as a free, open source project. It began in 1994 as a set of Common Gateway Interface binaries written in the C programming language by theDanish/Greenlandic programmer Rasmus Lerdorf. Lerdorf initially created these Personal Home Page Tools to replace a small set of Perl scripts he had been using to maintain his personal homepage. The tools were used to perform tasks such as displaying his résumé and recording how muchtraffic his page was receiving. He combined these binaries with his Form Interpreter to create PHP/FI, which had more functionality. PHP/FI included a larger implementation for the C programming language and could communicate with databases, enabling the building of simple, dynamic web applications. Lerdorf released PHP publicly on June 8, 1995 to accelerate bug location and improve the code. This release was namedPHP version 2 and already had the basic functionality that PHP has today. This included Perl-like variables, form handling, and the ability to embed HTML. The syntax was similar to Perl but was more limited, simpler, and less consistent. Zeev Suraski and Andi Gutmans, two Israeli developers at the Technion IIT, rewrote the parser in 1997 and formedthe base of PHP 3, changing the language's name to the recursiveinitialism PHP:Hypertext Preprocessor. The development team officially released PHP/FI 2 in November 1997 after months of beta testing. Afterwards, public testing of PHP 3 began, and the official launch came in June 1998. Suraski and Gutmans then started a new rewrite of PHP's core, producing the Zend Engine in 1999. They also founded Zend Technologies in Ramat Gan, Israel. On May 22, 2000, PHP 4, powered bythe Zend Engine 1.0, was released. On July 13, 2004, PHP 5 was released, powered by the new Zend Engine II. PHP 5 included new features such as improved support for object-oriented programming, the PHP Data Objects extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements. The most recent update released by The PHP Group is for the older PHP version 4 code branch. As of August, 2008 this branch is2大连交通大学2013届本科生毕业设计(论文)外文翻译up to version 4.4.9. PHP 4 is no longer under development nor willany security updates be released. In 2008, PHP 5 became the only stable version under development. Late static binding has been missing from PHPand will be added in version 5.3. PHP 6 is under development alongside PHP 5. Major changes include the removal of register_globals, magic quotes, and safe mode. The reason for the removals was becauseregister_globals had given way to security holes, and magic quotes had an unpredictable nature, and was best avoided. Instead, to escape characters, magic quotes may be substituted with the addslashes() function, or more appropriately an escape mechanism specific to the database vendor itself like mysql_real_escape_string() for MySQL.How PHP WorksPHP is generally used as a server-side scripting language; it is especially well-suited for creating dynamic web pages. The scripting language features integrated support for interfacing with databases such as MySQL, which makes it a prime candidate for building all manner of web applications, from simple personal web sites to complex enterprise-level applications. Unlike HTML, which is parsed by a browser when a page loads, PHP is preprocessed by the machine that serves the document (this machine is referred to as a server). All PHP code contained with the document is processed by the server before the document is sent to the visitor’s browser. PHP is a scripted language, which is another great advantage for PHP programmers. Many programming languages require that you compile files into machine code before they can be run, which is a time-consuming process. Bypassing the need to compile means you’re able to edit and test code much more quickly. Because PHP is a server-side language, running PHP scripts on your local machine requiresinstalling a server on your local machine, as well. The examples in this book rely on the Apache web server to deliver your web pages.Serving web pages with Apache HTTP Server is the most popular web server on the web; it hosts nearly half of all web sites that exist today. Apache is an open-source project that runs on virtually all available operating systems.1 Apache server is a community-driven project, with many developers contributing to i ts progress. Apache’s open-source roots also meansthat the software is available free of charge, which probably contributes heavily to Apache’soverwhelming popularity relative to its competitors, including Microsoft’s IIS and Google’sGWS, among others. On the Apache web site (), Apache HTTP Server is described as “an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient, and extensible server that provides HTTP services in sync with the current3大连交通大学2013届本科生毕业设计(论文)外文翻译HTTP standards.”Installing PHPApache, and MySQL (the Hard Way).One of the biggest hurdles for new programmers is starting. Before you can write your first line of PHP,you must first download Apache and PHP, and usually MySQL, and thenfight through installation instructions that are full of technicaljargon you might not understand yet. This experience can leave many developers feeling unsure of themselves, doubting whether they have installed the required software correctly. In my own case, this hurdle kept me from learning programming for months, even though I desperately wanted to move beyond plain ol’ HTML. I unsuccessfully attempted to install PHP on my local machine not once, but three different times before I was able to run my first PHP command successfully.Fortunately, the development community has responded to thefrustration of beginning developers with several options that take all the pain out of setting up your development environment, whether you create applications for Windows, Mac, or Linux machines. These options include all-in-one solutions for setting up Apache, MySQL, and PHP installations. The most common all-in-one solution is a program called “XAMPP”, which rolls Apache,MySQL, PHP, and a few other useful tools together into one easy installer. XAMPP is free and available for Windows, Mac, and Linux, so this book assumes you will use it as your development environment.Keywords and Language syntaxAs with many scripting languages, PHP scripts are normally kept as human-readable source code, even on production web servers. In this case, PHP scripts will be compiled at runtime by the PHP engine, which increases their execution time. PHP scripts are able to be compiledbefore runtime using PHP compilers as with other programming languages such as C (the language PHP and its extensions are written in). Code optimizersPHP is similar to most high level languages that follow the C style syntax. If conditions, for and while loops, and function returns are similar in syntax to languages such as C, C++, Java and Perl. PHP stores whole numbers in a platform-dependent range. This range is typicallythat of 32-bit signed integers. Unsigned integers are converted valuesin certain situations; this behavior is different from other programming languages. Integer variables can be assigned using decimal (positive and negative), octal, and hexadecimal notations. Floating point numbers are also stored in a platform-specific range. They can be specified using floating point notation, or two forms of scientific notation. PHP has a native Boolean type that4大连交通大学2013届本科生毕业设计(论文)外文翻译is similar to the native Boolean types in Java and C++. Using the Boolean type conversion rules, non-zero values are interpreted as true and zero as false, as in Perl and C++. The null data type represents a variable that has no value. The only value in the null data type is NULL. Variables of the “resource” t ype represent references to resourcesfrom external sources.These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examplesinclude file, image, and database resources. Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays. PHP also supports strings, which can be used with single quotes, double quotes, or heredoc syntax.Server-Side vs. Client-Side ScriptingThe Internet features two main kinds of scripting: server-side and client-side. Client-side scripting is comprised mainly of JavaScript, which is responsible for many of the web features that you can actually see happening, such as pop-up windows, some animations, and other site features like drop-down menus. The reason this is called “client-side” scriptingbecause the code is executed on the user’s machine, after the page has been loaded. Usingclient-side scripts enables you to make changes to a page without requiring a page refresh; it also facilitates initial form validation and simplifies making improvements to the user interface. However, using client-side scripts requires that the users have JavaScript turned on or that their browsers support the script you have written. This means you should not use client-side scripts for user authentication or the handling of anything sensitive, due to the user’s ability to modifyand/or disable your client-side scripts.Server-side scripting is performed on the site`s hosting server before the page isdelivered to the user. This means that any changes that must be made by the script require a page refresh. Using server-side scripting is great for user authentication, saving changes to database information, retrieving entries for display, and many other tasks. The downside of server-side scripts lies mainly in the required page refresh. Because the script is processed before it is delivered to the browser, the user doesn’t have access to the inner workings. Thismakes server-side scripts the best choice for handling any sensitive information.5大连交通大学2013届本科生毕业设计(论文)外文翻译中文翻译设置PHP开发环境对于一个不折不扣新手来说,将一个工作中的开发环境放在一起是可怕的。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

PHP基础语言外文翻译文献(文档含中英文对照即英文原文和中文翻译)原文:PHP Language BasicsActive Server Pages (PHP) is a proven, well-established technology for building dynamic Web applications, which provides the power and flexibility you need to create anything from a personal, Web based photo gallery to a complete catalogue and shopping cart system for your next eCommerce project。

One unique feature of PHP is that it lets you chooseyour favourite scripting language, be it JavaScript or PHP ; however, PHP is by far the most popular choice. In this article, I'll bring you up to speed on the basic syntax of the PHP language, including variables, operators, and control structures.This article is the second in a series teaching PHP. Specifically, the goal of this series is to teach you all you need to know to create dynamic Web sites using PHP. This article picks up right where the previous article in the series, Getting Started with PHP, left off.VariablesHere is the listing for the first PHP script I helped you create in the previous article:1 <html>2 <head>3 <title> My First PHP Page </title>4 </head>5 <body>6 <?php7 ' Write out a simple HTML paragraph8 Echo "<p>This is a test of PHP.</p>"9 ?>10 </body>11 </html>As I admitted in that article, this is a pretty uninteresting example of an PHP script. When it comes right down to it, this script doesn't do anything a plain, old HTML page couldn't do. Oh sure, I gave a slightly more interesting example that displayed the current server time, but to be really useful a script needs to perform some form of calculation, or manipulate dynamic information to present it in some interesting way.The language used for writing most PHP programs, and which I'll be using throughout this series, is called PHP . Like most programming languages, PHP lets you store data in variables. A variable may be thought of simply as a named location in memory where data may be stored. PHP is what is known as a loosely typed language, which means that a particular variable may store any kind of information, be it a number, a piece of text, a date, or some more complicated chunk of data (as opposed to strictly typed languages where you can only store one kind of information in each variable). Before you can use a variable, though, you must declare it; that is, you must let PHP know that you want to create a variable with a particular name.Let's look at a basic example to help solidify these concepts in your mind. Say you were writing a Web page that performed conversions between Celsius and Fahrenheit temperatures. In countries where Celsius is used, 20&deg;C is commonly accepted as the value for room temperature. The following code creates a variable called intRoomTempC,and then assigns it a value of 20:New Revised 2nd Edition Out NOW!"Build Your Own Database Driven Website Using PHP & MySQL"Fully updated for PHP 4.3.Installation instructions for Mac OS XFull index providedNew wider book sizeEnhanced fontsNew cover designLay-flat spineAll content revisitedDownload the First 4 Chapters FREETell me more about this top-selling book.$ intRoomTempC ' Create a variableintRoomTempC = 20 ' Assign the variable a value of 20The keyword $ in the above is short for $ension, and is used to tell PHP to create a variable with the name specified (in this case, intRoomTempC). Why '$ension', you ask? I agree, it's not the most obvious choice, but basically it refers to what you're asking PHP to do. When creating a variable, PHP needs to assign some space in memory to store whatever value(s) will be placed in the variable, and part of thattask is to figure out the size ($ension) of the space that needs to be allocated. In any case, creating a variable is as simple as typing $ followed by the name of the variable.The second line of the above example assigns a value to the variable that was just created; specifically, it stores the number 20 in the variable. The equals sign (=) is called the assignment operator because it is used to assign values to variables. During the course of this article, you'll meet many other operators that do other weird and wonderful things to variables and the values they store.You should always create a variable before assigning it a value, and you'll usually want to assign the variable a value before putting it to use. Trying to assign a value to a variable that does not exist, however, will cause PHP to automatically create a new variable with the given name. This is called implicit declaration, because a new variable is declared implicitly as a result of your trying to assign a value to a variable that doesn't exist. Since you are free to use implicit declaration for all of your variables, you may be wondering what the point is of using the $ command to create each and every variable by hand.The answer has to do with how easy you want it to be to find typing mistakes in your code. PHP provides another command, Option Explicit, which causes PHP to disallow implicit declarations and instead display an error message whenever you try to assign a value to a non-existentvariable. Why would you want this to happen? Consider the following example:$ intRoomTempC ' Create a variableintRomTempC = 20 ' Assign the variable a value of 20If you have a keen eye, you may have noticed that the variable name is misspelled on the second line. This is the kind of mistake that even experienced programmers make all the time. With implicit declaration enabled, the second line will create another new variable called intRomTempC and will store the value in that variable instead. Now, if the rest of your script expects that value to be stored in intRoomTempC, you're going to run into trouble. In a large script, tracing such a problem back to one little typing mistake can be very time consuming. That's where Option Explicit comes in:Option Explicit ' Disable implicit declaration$ intRoomTempC ' Create a variableintRomTempC = 20 ' Assign the variable a value of 20This time, PHP will report the typing mistake as an illegal implicit declaration, displaying an error message to that effect with the exact line number where the typing mistake was made. For this reason, I tend to explicitly declare all my variables with $ and specify Option Explicit on the first line of all of my PHP scripts. It might take slightly longer to type,but it saves a lot of headaches when something goes wrong.A shortcut exists for creating several variables at once on the same line. For instance, the following line would create two variables, intRoomTempC, and intFreezingC:$ intRoomTempC, intFreezingC ' Two variables in one lineBy now you may be wondering about my naming convention for variables. The two variables created in the above snippet both begin with int. I'm using this prefix to indicate that these variables will contain integers (whole numbers). You can feel free to name your variables whatever you like and store whatever kind of data you like in them, but I prefer to use this convention as a helpful reminder of the type of information in each variable. This practice of prefixing variable names with a clue as to their type is known as Hungarian notation, and I'll introduce additional prefixes for other data types as they arise over the course of this series.The Web has grown beyond the point where an online brochure will satisfy a typical company's needs for its Web presence. If you aim to market yourself as a Webmaster these days, you need to have some skill building online applications –Web sites that users can interact with, whether to get something done (e.g. send email), get information targeted to their specific needs (e.g. a real-time stock quote), or to interact with other users (e.g. an online community).In this series of articles, I’ll guide you through the process of learning one of the most popular frameworks for creating dynamic Web sites such as these –Active Server Pages (PHP). If you can secure a strong knowledge of PHP, as well as some practical experience building Web sites with it, you should never have trouble getting work as a Web developer. A quick search of your favourite online job directory with the keyword 'PHP' should be more than enough to convince you of that.In this first article, I'll help you get your feet wet by introducing the PHP programming language, and how to use it to write dynamic Web pages with PHP. Before I get to that, I shall stop to explain how server-side scripting, and PHP in particular, differs from other Web scripting technologies that you may be familiar with, such as client-side JavaScript. This will get you armed with the proper vocabulary and ensure that we're on the same page before launching headlong into the brave, new world of PHP.Server-Side ScriptingTo understand where PHP fits into the big picture of Web development, you need to understand the concept of a server-side scripting language. If you've programmed Web pages in Perl, PHP, JSP, or Cold Fusion before, you can safely skip this section –all of those are server-side scripting languages, and PHP works in much the same way. If you're coming to PHP armed only with knowledge of HTML (andperhaps with some CSS and/or JavaScript experience) then you'll find that server-side scripting is quite a bit different.Let me begin by giving you a quick review of how standard, non-PHP Web pages work. As shown in Figure 1, the Web browser on the client computer (the computer belonging to the user) makes a request for a page, say file.html (1). Assuming the requested file exists on the Web host computer where the Web Server software can find it, that software replies to the request by sending the file back to the browser (2). Any additional files (images, for example) required to display the page are requested and received in the same way. The protocol used for this exchange, and indeed for all communication between Web browsers and Web servers is called Hypertext Transfer Protocol (HTTP).If you've ever used any JavaScript in your pages, you know that the requested Web page (file.html) can contain, in addition to plain HTML code, small programs written in JavaScript. These programs, or scripts, are read and executed by the Web browser while the page is displayed in the browser. So the Web browser must understand not only how to read HTML and display textand images, but it must also be able to run JavaScript programs appearing inside Web pages. This arrangement, where the Web browser runs the script after receiving it from the Web server, is called client-side scripting. The name makes sense –all of the script runs on the client-side –theright-hand side of Figure 1. The Web server is completely oblivious to whether the file it is sending contains a script or not; it’s all up to the browser (the client) to handle execution of the script.PHP fits into a different category of technologies, called server-side scripting, where it is no longer the browser running on the client that is responsible for running the script; instead, it is the Web server that runs the script. This process is illustrated in Figure 2. As before, the Web browser requests a file (1). In this case, however, the filename ends with .php (file.php, for example), branding it as a file containing an PHP script that needs to be processed by the server. The server recognizes this, and instead of directly sending the requested file back to the browser, it sends the file to the PHP scripting engine (2). The engine is a component of the Web server software that can interpret PHP scripts and output the results as HTML. The trick here is that any given script can output different HTML each time it is run, so what comes out of the PHP engine can be different for each client (browser) request. That dynamically generated page is then sent to the browser in response to its request (3), in exactly the same way as the static page was sent in the previous example. Just as when the page contained client-side JavaScript and the server was completely unaware of this fact, when the page contains server-side PHP script, the browser does not know this at all. The PHP code contained in the page is interpreted and converted to plain HTML by the PHP enginebefore the browser gets to see it; so as far as the browser is concerned an PHP page looks just like any normal Web page. All the work is done on the server-side; thus the name, server-side scripting.翻译:PHP基础语言PHP是构建动态网页应用的被实践证明了的技术,为你需要创建任何的东西从一个基于图片库个人网页到一个完整的目录,为你的下一个商业项目提供全面的系统提供了强大的功能和灵活性。

相关文档
最新文档