1. What is PHP
PHP is a powerful server-side scripting language for creating dynamic interactive sites. Especially suitable for web development and can be embedded in HTML. Its syntax leverages C, Java, and Perl and is easy to learn. The main goal of the language is to allow web developers to quickly write dynamically generated web pages, but PHP can be used for much more than that.
PHP is free and widely used. At the same time, PHP is undoubtedly another efficient option for competitors like Microsoft ASP.
A simple example to introduce you to PHP
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php.cn</title> </head> <body> <?php echo "Hello World!!!"; ?> </body> </html>
2. Why learn PHP
For To make money, for hobbies, to become a big boss, for girls, to comply with the national Internet + initiative, PHP can help you with all of the above
1. About 70% of the top 1 million websites in the world The site is developed with PHP, which forms a golden partner with Linux/Mysql/Apache/etc. Regardless of cost investment and development cycle considerations, PHP is a good choice.
2.PHP can be used in website development, API interface development, server-side development, advertising system development, internal OA system development, mobile backend development, game development, etc. Especially today with the rapid development of mobile Internet, PHP Take the opportunity to rise to the top and return to the ranks of first-line development languages.
3. Getting started with PHP is easy, and you can quickly create your own project
4. There are many mature PHP templates for reference (thanks to its open source and sharing)
5. High development efficiency and simple program
3. How to learn PHP
Let’s take a look at the learning route for PHP beginners Summary:
l Familiar with the basic elements of web pages such as HTML/CSS/JS, you can create simple web pages by yourself during the completion stage, and you are relatively familiar with element attributes.
l Understand the concepts and operating mechanisms of dynamic languages, and be familiar with basic PHP syntax.
l Learn how to combine PHP with HTML to complete a simple dynamic page.
l Get in touch with MySQL and start designing databases.
l Continuously consolidate PHP syntax, be familiar with most of the common PHP functions, understand object-oriented programming, MySQL optimization, and some templates and frameworks.
l Finally complete a fully functional dynamic site.
Details here:
l Newbies should not think that learning PHP is very simple after seeing the above summary. Programming requires serious thinking and continuous practice. The following is a detailed explanation of the PHP learning route. First of all, any website is composed of web pages, which means that if you want to complete a website, you must first learn to make web pages. Mastering the technology of making static web pages is a prerequisite for learning to develop websites. Therefore, we need to learn HTML to lay the foundation for making websites in the future. Learning HTML should be done while learning. Every element in HTML must be practiced personally. Only after you understand what elements will have what effect can you remember them deeply. Just reading books will not work.
l Assuming that you can already complete a static page, then you should start to understand dynamic languages. When you first come into contact with dynamic languages, many people may have a lot of confusion. The code is not output directly, but needs to be processed. , HTML passes through the HTML parser, and PHP also passes through the PHP parser. Just like learning HTML, if you want any parser to work, you must use its dedicated syntax structure.
l You should feel lucky to learn PHP, because if you have learned other languages, you will find that PHP is relatively simple. At this stage, you have to understand the concepts of HTML and PHP. You are now completely You can ask PHP to calculate for you how much one plus one equals, and then output it in the browser. Don't feel naive. Although this is a small piece of code, it is a big step forward in your programming journey. But now, you are still a php.
l The next step is to learn the database. MySQL can be said to be the golden partner of PHP. We want to conquer this database. After you understand the concept of the database, you must try to connect to the database through PHP, and then you will Successfully insert, delete and update data using PHP.
l At this time, you may be in this state: Do you know HTML? Yes, I can compile several web pages with table layouts! Do you know PHP? Yes, I will write the operation of one plus one in the function and then call it! Do you know MySQL? Yes, I can insert and delete data in the database!
l So what should we do next? Try making a small guestbook. This is also a hurdle faced by novices. After a while, you finally learned to insert the form data into the database and then displayed it. It should be said that the prototype of a program has been born. However, you may look at someone's editing forum or developing CMS. When can I write one? Don't worry, consolidate your knowledge and become familiar with the essentials of PHP and MySQL development. Then look back at the guestbook you wrote. You may wonder if it was really written by you? At this time, you can improve the guestbook you wrote. The guest book should have registration and paging functions, and if possible, the UI can also be enhanced.
l Does this count as learning? NO, NO, NO, it's still early. You haven't touched OOP yet, right? What about templates and frameworks? Still have to continue learning! The PHP framework provides a basic framework for building web applications, thereby simplifying the process of writing web applications in PHP. It can save development time and help build more stable applications. So, PHP framework is a tool that can be used to save time and enhance your code. When you first choose a PHP framework, it is recommended to try several. Each framework has its own strengths and weaknesses. For example, the Zend framework has been popular for a long time due to its diverse functions and a wide support system. CakePHP is a PHP framework later than Zend, and the corresponding support system is relatively small, but it is more convenient and easier to use.
l After understanding object-oriented and frameworks, you should get in touch with XML. In short, you will never find that you have learned everything, and there is no end to learning! When learning something, never expect a quick fix. No matter how many skills you have, it will be in vain if you lack hard work. One thing that can be guaranteed is that if you have learned PHP, then you will definitely learn other languages quickly. Vice versa, if you have learned other languages before, then you will definitely learn PHP quickly.
l It is definitely beneficial to learn more from other people's successful codes, so looking at those classic codes that have been refined over time is the best way to make progress. In addition, it should be emphasized that you may encounter difficulties and get confused when learning a technology. You may have learned half of PHP and start thinking about C# again, or someone may say that Java is very good. At this time, you must not Wave, persist, and learn thoroughly.
l In short, you must remember three sentences: type code! Code! ! Type the code yourself! ! ! , I believe you will gain a lot in the process of knocking. I wish you all can learn PHP as soon as possible and develop the website you want.