Top Ten tips for mastering PHP (top) _php tutorial

Source: Internet
Author: User
1. Use Php-rasmus Lerdorf at the right time
No one than the PHP creator Rasmus Lerdorf understand where PHP is more reasonable, he released the language of PHP in 1995, since then, PHP like a prairie fire, burning all over the development camp, changed the world of the Internet. However, Rasmus does not create PHP for this reason. PHP was born to solve the real problems of web developers.

like many open source projects, PHP has become popular, and popular motives are not interpreted with normal philosophy, and even somewhat narcissistic. It can be used as a case, a case of a tool that solves a variety of web problems, so when PHP first appears, this tool needs to be focused on PHP.

However, you can't expect PHP to solve all the problems. Lerdorf is the first person to admit that PHP is just a tool, and PHP has a lot of things that the force can't.

Choose the right tool according to the different work. I ran a lot of companies to persuade them to deploy and use PHP, but that doesn't mean that PHP works for all problems. It just can be a front-end Footstep language that solves most of the problems.

As a web developer, trying to solve all of the problems with PHP is unscientific and will waste your time. When PHP is not playing, do not hesitate to try other languages.

2. Increase scale scalability with multi-table storage-Matt Mullenweg

No one wants to question Matt Mullenweg's authority in PHP, and he has developed the most popular blogging system on the planet, backed by a strong community power: Wordpress. After creating WordPress, Matt and his team launched the WordPress.com platform, a free blog site based on WordPress MU. Now, WordPress.com already has about 4 million users, who provide more than 140,000 logs per day. (To see more wordpress.com statistics, please click here.)

If someone knows how to make the site scalable, this person must be Matt Mullenweg. In 2006, Matt made a forward-looking improvement to the WordPress data structure and explained why WordPress Mu used a separate MySQL table for each blog, rather than stuffing all the blog data into a huge form.

We tested this method, but found that if we were to extend its scalability it would be too expensive. If you use a whole data structure, in the face of large traffic, you will face the problem of server hardware. Inside the MU. Users are distributed in separate tables and can be easily organized. For example, WordPress.com stores the user's data in 4,096 databases, which can disperse large-scale data access and achieve traffic and pressure diversion.

The mobility of the data tables allows the Code (blog) to run faster, and the system to be more scalable. Relying on the powerful caching strategy and flexible database application strategy, Matt showed people that the most popular Facebook and wordpress.com are running stably under PHP and handling amazing traffic.

3. Never trust the user-Dave child

Dave Child is the core of the Added Bytes (previously ilovejackdaniels.com) website with his excellent cheat sheets for many programming languages Famous. Dave serves a number of British companies and has established considerable authority in the programming world.

Dave provides a lot of thoughtful advice to PHP developers and concludes with writing secure code in PHP: Don't trust your users, they might even hurt you.

There is a basic principle of web development, I repeat many times do not feel enough, that is: do not trust your users, but also assume that every unit of data in your site is collected from users of malicious code. Most of the time, you have to use JavaScript to submit the content in the client inspection form, and if you get used to it, then it's a good habit. If security is important to you, this is the most important principle to learn.

Dave is currently working on an example for its Writing Secure PHP series of books, which he said at the end of the book:

Finally, become paranoid. unless you think your site will never be attacked, look squarely at all the problems, and when the problem really happens, your situation will get very bad. You need to regard each user as a hacker who will bring a defensive station, and try every means to protect the security of the site, while thinking about the solution of the corresponding problem.

4. Use PHP cache more-Ben Balbo

Ben Balbo developed site Point, a website that provides guidance for developers and designers. He is a member of the Melbourne PHP development and Open Source Club, so he has a certain understanding of PHP and has some ideas and experience with PHP caching.

If you have a large number of visits, but not frequent sites (such as blogs, based on some kind of CMS), perhaps it needs some transformation, these changes will not take too much time, but the performance has a prominent contribution. The process can be tortuous if you want to create a caching mechanism for a site with complex/updated frequencies, but the benefits are obvious.

There are many kinds of PHP caching techniques, and Ben recommends the following for us:

Running results of the cache function
Set Expiration Time
Cached files for IE downloads
Template Caching Technology
Cache_lite

Because of the nature of PHP as a dynamic language, the caching mechanism is very important for sites that are not updated at a very fast rate.

5. Use IDE, templates and snippets to accelerate PHP development-Chad Kieffer

When Chad Kieffer from the UI design and database optimization work, he will share a lot of technical experience on his blog, 2 tablespoons. Due to the comprehensive development of Chad, he often discovers problems that other programmers cannot find, and develops relevant experience, especially the way he develops the website. He is involved in all aspects of website development, so his advice is very useful for improving the bigger picture of website development.

Chad thinks that using Eclipse PDT
IDE (Eclipse's PHP development package), while using some template technology and open source projects can effectively improve the speed of PHP development.

The compact plan, long-to-do lists and deadlines make developers very depressed. However, some features, such as Eclipse Templates, can effectively reduce the time to encode and the chance of error.

In general, any project can be automated, the higher the degree of automation, the less time you have to complete the project. Taking the time to develop frameworks and templates with high frequency will save you more time later. At the same time, using an IDE like Eclipse and the PDT package, you will find that efficiency is significantly improved, the IDE can automatically close, complete the semicolon and can debug locally.

Related Posts:

  1. WordPress successfully upgraded to 2.3.2 Although the tag is useless to me, but looking at security, I still upgrade, From the 2.0.5 two years ago to the current 2.3.2, really need a courage and determination, fortunately in the local run upgrade without any problems, but the template function requires some simple changes. Online upgrade everything goes well, many people will wonder, you just did not send post help upgrade method? Well, I have found the best tool, WordPress Automatic Upgrade plugin This wordpress automatic upgrade plugin really lets you upgrade worry-free, because it will be before the upgrade for you to back up all the files and data, used to be "all the way Next" type, I believe it is very suitable for those who do not want to worry about the upgrade of bloggers, but there is a problem, upgrade after the export function problems, Hint can not find wp-config.php, do not know is generally have this problem or my blog problem, meet the same problem friend please give me a message, I will study the solution. (after the research found that the original is the Coolcode plug-in access to the path of the problem, as long as the activation of the plug-in, the export function can be used normally) ...
  2. Who has the experience of upgrading from Wordpress2.0 Today downloaded wordpress-2.3.2, originally wanted to upgrade, but found that the version span is not small, the data structure changes seemingly not small, upgrade is troublesome, the risk is too big, so temporarily give up, which friends have from wordpress2.0 to 2.3 experience, share it, grateful. ...
  3. Translation: "14 excellent webmaster Tools" (under) Original: http://www.conversion-rate-experts.com/articles/understanding-your-visitors/ This article is by Andrew (http://www.achome.cn) self-translation, if you need to reprint please indicate the source. Users are the best publicity and sales staff to listen to how they advertise it, Tell-a-friend king-immediately experience! Do you have a user-recommended system? A system that allows users to send letters to invite friends. We can see that these users send a letter containing the answer to the question "Why users spend on your website". Many people spend a lot of time positioning themselves and making attractive advertising words, but by using a user's letter of recommendation, you can find out why users favor you. Easily collect user feedback and kampyle-experience now! Kampyle can allow users to submit user feedback on your site (via a small button at the bottom of the page), and a window will pop up to allow users to fill in their comments and suggestions. Webmaster can log in to Kampyle's official website to view and manage the collected user feedback, if the user left an email address, webmaster can also easily notify users, they have received feedback and will make corresponding improvements. ...

http://www.bkjia.com/PHPjc/319800.html www.bkjia.com true http://www.bkjia.com/PHPjc/319800.html techarticle 1. In the right time to use Php-rasmus Lerdorf no one than the creator of Php Rasmus Lerdorf understand where PHP is more reasonable, he released the language of PHP in 1995, from then on ...

  • 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.