Home  >  Article  >  Backend Development  >  Top Ten Points You Need to Pay Attention to Mastering PHP (1)_PHP Tutorial

Top Ten Points You Need to Pay Attention to Mastering PHP (1)_PHP Tutorial

WBOY
WBOYOriginal
2016-07-15 13:25:29790browse

1. Use PHP when appropriate - Rasmus Lerdorf

No one understands where PHP should be used more rationally than Rasmus Lerdorf, the creator of PHP. He The language PHP was released in 1995. Since then, PHP has been like a prairie fire, burning through the entire development camp and changing the world of the Internet. However, Rasmus did not create PHP for this reason. PHP was born to solve practical problems of web developers.

Like many open source projects, PHP has become popular. The motivation for its popularity cannot be explained by normal philosophy, and it is even so popular that it is somewhat self-admiring. It can be used as a case, a case caused by the need for tools to solve various web problems. Therefore, when PHP first appeared, all such tool needs were focused on PHP .

However, you cannot expect that PHP can solve all problems. Lerdorf is the first to admit that PHP is just a tool, and there are many situations where PHP is beyond its capabilities.

Choose the right tool according to the job. I have gone to many companies to convince them to deploy and use PHP, but this does not mean that PHP is suitable for every problem. It is just a front-end scripting language that can solve most problems.

As a web developer, trying to solve every problem with PHP is unscientific and a waste of your time. When PHP doesn't work, don't hesitate to try other languages.

2. Use multi-table storage to improve scalability - Matt Mullenweg

No one wants to question Matt Mullenweg’s authority on PHP, he developed the The most popular blogging system (supported by a strong community): Wordpress. After creating WordPress, Matt and his team launched the Wordpress.com platform, a free blog site based on WordPress MU. Today, WordPress.com has approximately 4 million users, who contribute more than 140,000 posts every day. (To see more WordPress.com statistics, click here.)

If anyone knows how to make a website scale easily, it’s Matt Mullenweg. In 2006, Matt made forward-looking improvements to WordPress's data structure and explained why WordPress MU uses independent MYSQL tables for each blog instead of stuffing all blog data into one huge table.

We tested this approach, but found that it would be too expensive to extend its scalability. If you use an overall data structure, you will face server hardware problems in the face of large traffic. Inside MU. Users are distributed into separate tables and can be easily organized. For example, WordPress.com stores user data in 4,096 databases. These databases can disperse large-scale data access and divert traffic and pressure.

The portability of data tables allows the code (blog) to run faster and makes the system more scalable. Relying on powerful caching strategies and flexible database utilization strategies, Matt showed people that the most popular Facebook and WordPress.com can run stably under PHP and handle an astonishing amount of traffic.

3. Never trust the user - Dave Child

Dave Child is the core figure of the Added Bytes (previously ilovejackdaniels.com) website, which is famous for his excellent Famous for "cheat sheets for many programming languages". Dave works for a number of UK companies and has established himself as an authority in the programming world.

Dave has provided a lot of thoughtful advice for PHP developers, summarized in "writing secure code in PHP": Never trust your users, they may even hurt you.

There is a basic principle of web development that I cannot repeat enough times, and that is: Never trust your users and make assumptions about every data unit in your website They are all malicious codes collected from users. Many times, you have to use JavaScript to verify the content submitted by the form on the client. If you are used to this, then this is a good habit. If security is important to you, this is the most important principle to learn.

Dave is currently working on organizing examples for his "Writing Secure PHP" series of books. At the end of the book, he said:

Finally, Get paranoid. Unless you think your site will never be attacked, face the problem head on because when it does happen, you're going to be in a bad situation. You need to regard every user as a hacker who will bring about an attack and defense on the site, do everything possible to protect the security of the site, and at the same time think of solutions to the corresponding problems.

1

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446668.htmlTechArticle1. Use PHP when appropriate - Rasmus Lerdorf No one understands the use of PHP better than Rasmus Lerdorf, the creator of PHP What makes more sense, he released the PHP language in 1995, and since then...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn