How hard it is to use and learn PHP

Source: Internet
Author: User
Tags learn php hosting companies
PHP is not a sophisticated technology, but at the same time, you don't expect to be an expert within 5 minutes. For beginners, the biggest adaptation may be that PHP's fault tolerance is much lower than the browser's tolerance to HTML. If an end tag is omitted from the HTML, most browsers will still display the page. In PHP, if you omit an end Quote, semicolon, or curly brace, you get an error message as shown in Figure 1-3. This is not only a feature of PHP, all server-side technology is the same, including ASP, ASP. NET and ColdFusion.

Figure 1-3 Server-side languages like PHP do not tolerate most coding errors

If you're a web designer or developer who uses visual design tools, such as Adobe Dreamweaver or Microsoft Expression Web, and never pay attention to the underlying code, it's time to rethink your approach. Mixing PHP with poorly structured HTML can cause some problems. PHP uses loops to perform repetitive tasks, such as displaying the results of a database search. A loop repeats the same piece of code (the code usually contains both PHP and HTML) until all results are displayed. If you put the loop in the wrong place, or the HTML is poorly structured, then the page might collapse like a house of cards. If you're not used to doing this, it's a good idea to use the markup Validation Service (Validator.w3.org/unicorn) of the world Wide Web Consortium to check your page.

It is an international organization that is responsible for setting standards (such as HTML and CSS) and developing guidelines to ensure long-term web development. It was led by Tim Berners-lee, creator of the World Wide Web. To understand the mission of the Consortium

Is it possible to copy and paste only the code

There is nothing wrong with copying the code in this book, which is exactly what they exist for. Replication is a method we have learned as a child, but most of us will be free from the stage of imitation, and we will ask questions and start experimenting on our own. I'm not going to teach you to learn PHP with tedious exercises that don't have direct value to the Web, and this book is meant to allow you to directly apply the new knowledge to the actual project. At the same time, I'll explain what the code is for and why it's there. Even if you don't understand exactly how it works, you'll get enough knowledge to understand which part of the code fits your needs and which part is best to ignore.

PHP is a toolkit that provides a lot of powerful functionality. It has thousands of built-in functions that can perform a variety of tasks, such as converting text to uppercase, generating thumbnails from full-sized images, or connecting to a database. The real power is to combine these functions in different ways and add them into your own conditional logic. To learn more from this book, you need to experiment with the tools you learned in the book and present your own solutions.

Security for PHP

PHP is like a power or chopper in your home: If used correctly, it is very safe, and if it is operated irresponsibly, it can cause a lot of damage. One of the inspirations from the 1th edition of this book came from a spate of malicious attacks at the end of 2005. These attacks exploit a vulnerability in e-mail scripting to turn a Web site into a spam relay. Few people are safe from harm. I was certainly not spared, but aware of the problem, I patched up the loophole and stopped the malicious attacks in time. However, every day someone sends an urgent request to an online forum for help. Even when they are told how to deal with the problem, their response becomes even more maddening. Many people admit that they have absolutely no knowledge of the code they use on the site. It may seem understandable that some people think of creating websites as a hobby, but many of them are "professionals" who create websites for their clients. When these customers ' mailboxes start to fill with spam, they are naturally unhappy. When hosting companies disable a client's domain name because they cannot tolerate unsafe scripting on the server, they are no doubt more unhappy.

The implication of this story is not that PHP is unsafe, or that everyone needs to be a security expert using PHP. It is important to understand the basic principles of PHP Security: it must be checked before processing user input. You will find that this will become a theme throughout the book. With little effort, most security risks can be eliminated.

The most worrying aspect may be that after more than five years of this problem being revealed, I still see many people using unsafe mail scripts. The best way to protect yourself is to understand the code you're using. Even if you can't solve the problem yourself, you can implement remedial actions that are recommended by script writers or other experts.

The above is how to use and learn PHP how difficult content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

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