PHP learning notes start from building a PHP development environment

Source: Internet
Author: User
Tags php development environment
PHP learning notes-starting from setting up the PHP development environment, when talking about PHP, the first thing that comes to my mind is the Facemash picture of Mark in "social networking" in the bedroom. This is one of the reasons why I learned PHP. I will not be arrogant about the advantages of PHP. I will know the famous domestic and foreign websites that use PHP + MySQL technology. To learn a language, you must start by building a development environment.

I am using the Windows 7 operating system. to build a PHP development environment on Windows, you can download the integrated installation package WAMP (short for Windows, Apache, MySQL, and PHP. In this way, you do not need to install Apache, MySQL, and PHP separately. Some people have already installed IIS on their computers. the default port of IIS is port 80, while Apache uses port 80. there are more than one solution to the conflict, you can modify httpd in the Apache installation directory. conf file, disable IIS, and so on. My personal method is to change the default port of IIS to port 81. Open the IIS Manager, select "Default Web Site", and click "bind" on the right to modify the port.

Run wampServer and click Apache. a test port 80 is available under the Service Directory. In addition to IIS, many software also occupies port 80, such as thunder and cool dog.

After resolving the port conflict, you need to set PHP. Check the "short open tag" and remove the check before "display errors. This will support This label.

As for IDE, I am using eclipse, and zend studio is a good reputation among others. This section describes how to make eclipse support PHP. First, you must download an eclipse. After the installation is complete, run eclipse and find "Instal New Software" under "Help" on the main interface ".

Then select "All Available Sites" in Work ".

  

Wait a moment, find PDT in "programming language", and click NEXT.

After installing PDT, you can use eclipse to compile PHP.

The following is a question I encountered during my study today. First look at the code:

 

After carefully reading the code at 1 and 2, we can find that there is a single quotation mark before and after the submit at 1, and there is no single quotation mark for the user at 2. If you remove the single quotes at 1, the program will warn you, and adding single quotes at 2 will report an error. Why?

In fact, it is no big difference to add a single quotation mark. The only difference is that the efficiency of adding single quotes is higher than that of without single quotes because $ _ POST [submit] without single quotes is not added. php will first check whether there is a defined submit constant in php full text. if it cannot be found, it will put the submit in front of the string and then find the value of $ _ POST ['submit; if quotation marks are added, the value of $ _ POST ['submit '] will not be used to judge whether the submit is a constant. therefore, it is best to put quotation marks in every place. an error occurs when a single quotation mark is added to an SQL statement. that is, a single quotation mark is used outside the SQL statement, and a single quotation mark is also used in the SQL statement. This will naturally cause an error in the SQL statement, in this case, you need to escape the slash.

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.