Introduction to the--php of Reverse teaching series (i)

Source: Internet
Author: User

What is PHP? In fact, HTML is a feature-enhanced version. The Web site is on the server, if the client asks the server to request the Web page file (xxx.html), then the server will send the client-specified page back. (According to my understanding,) PHP is due to "form", the so-called form, is to fill in the information on the Web page, and then use a Submit button sent to the server. The "Send to the server" here, in fact, with a completed form to call the PHP file-if you call an HTML, only need to send the address, but want to call PHP, must carry the form, and only the submit button can do this call. When PHP receives a form, it returns a Web page (not itself) based on the specific contents of the form, which is the name of the PHP (which is the same as HTML). In terms of content, PHP simply puts a block of dynamically changing parts into the normal HTML code, and the block returns what should be shown here based on the form. After substitution, PHP and HTML are identical in format-except for the suffix name.


But this process must have someone to do, HTML display is a browser thing, PHP substitution is a server thing, naturally cannot be translated in thin air. This is the PHP environment to do, here is Wampserver, Legend is the simplest to install, only need to constantly default, I just put the installation directory in the D-disk folder (even if not change, also to remember the directory, a few useful). Install it and start it--however, there is no interface, only the green icon in the lower right corner (if it's yellow, find another tutorial) to tell you it's really open. Enter localhost (or 127.0.0.1) in the browser address bar, and if the service is valid, you will see something, and the skin is optional ... (The Classic on the right)


You can take the address bar "localhost", or "127.0.0.1" as a folder, but because it is a website service, was changed to "domain name." In fact it is indeed a folder, named WWW, located in the installation directory of Wampserver. If you have learned some HTML knowledge, then you will know that if the address bar has only an address, it will display something named index (HTML or PHP, but it appears that PHP is preferred). Change the Address bar's localhost to localhost/index.php, nothing will change, even the latter is the source.


Now start our hellophp--in the WWW directory to create hellophp.html and hellophp.php, fill in the hellophp.html: (Here a few filenames a bit around)

<form method= "POST" action= "http://localhost/hellophp.php" ><label for= "ClientName" >your name:</ Label><input type= "text" id= "ClientName" name= "ClientName" ><input type= "Submit" value= "Submit" Name= " Submit "/></form>


Fill in the hellophp.php: (if there is a programming and HTML basis, it is easy to guess the meaning)


Save two files. Then open the browser and enter localhost/hellophp.html carriage return in the Address bar. It's supposed to be--


Just fill in a name, click Submit, I fill in the louis--


The first exercise is complete. Interestingly, PHP has an interpreter, but I'm not sure I can join the form. Without a form, the $_post variable should not work, but other variables are still the same. You can find Php.exe, add the environment variable path, and then use PHP xxx.php in the command line to interpret a PHP file, and you will get the translated HTML (in the form of command-line printing), after all, PHP is essentially a translation.


(Php.exe is located in: Wamp installation directory \bin\php\phpx.x.x, there are several version numbers, I chose the largest)


Then write the helloworld.php (at any location):

<?phpecho ' Hello world! ';? >


Hold shift right in this position to select Open command line, PHP helloworld.php Enter, ...


But I think I can only know this ...


(2018-2-11 on Earth)

Introduction to the--php of Reverse teaching series (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.