How difficult is it to use and learn PHP?

PHP中文网
Release: 2023-02-28 22:46:01
Original
1160 people have browsed it

PHP is not a complicated and advanced technology, but at the same time, you should not expect to become an expert in 5 minutes. For novices, the biggest discomfort may be that PHP's fault tolerance is much lower than the browser's fault tolerance for HTML. If you omit a closing tag in HTML, most browsers will still display the page. In PHP, if you miss a closing quote, semicolon, or brace, you'll get an error message like the one shown in Figure 1-3. This is not just a feature of PHP, but is true of all server-side technologies, including ASP, ASP.NET, and ColdFusion.

How difficult is it to use and learn PHP?

Figure 1-3 Server-side languages ​​like PHP are not tolerant of most coding errors

If you are a web designer or developer using a visual design tool such as Adobe Dreamweaver or Microsoft Expression Web, and Never pay attention to the underlying code, then it's time to rethink your approach. Mixing PHP with poorly structured HTML can cause problems. PHP utilizes 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, the page has the potential to collapse like a house of cards. If you're not comfortable doing this yet, it's a good idea to check your pages using the W3C's (World Wide Web Consortium) Markup Validation Service (validator.w3.org/unicorn).

W3C is an international organization that sets standards (such as HTML and CSS) and develops guidelines to ensure the long-term development of the Web. It is led by Tim Berners-Lee, the founder of the World Wide Web. To understand the mission of the W3C

Can you just copy and paste the code

There is nothing wrong with copying the code in this book, that is exactly what they are there for. Copying is something we all learn as children, but most of us move beyond the imitation stage and we ask questions and start experimenting ourselves. I don't intend to teach you PHP with some boring exercises questions that have no direct value to web pages. The purpose of this book is to allow you to directly apply the newly acquired knowledge to actual projects. Also, I'll explain what the code does and why it's there. Even if you don't understand exactly how it works, you'll gain enough knowledge to know which parts of the code suit your needs and which parts are best left alone.

PHP is a toolbox that provides a lot of powerful features. It has thousands of built-in functions that can perform various tasks like converting text to uppercase, generating thumbnails from full-size images, or connecting to a database. The real power lies in combining these functions in different ways and adding your own conditional logic. To learn more from this book, you'll need to experiment with the tools you learn in it and come up with your own solutions.

PHP’s Safetyness

PHP is like an electricity or kitchen knife in your home: if used correctly, it is very safe; if operated irresponsibly, it can cause many injuries. One of the inspirations for the first edition of this book came from the spate of malicious attacks that broke out in late 2005. These attacks exploit a vulnerability in email scripts to turn websites into spam relays. Few people were spared. Of course I was not immune, but after realizing the problem, I patched the vulnerability and stopped these malicious attacks in time. Still, people send urgent requests for help to online forums every day. Even when told how to deal with the problem, their responses became even more frantic. Many people admit that they have no idea about the code they use in their websites. It may seem understandable that some people create websites as a hobby, but many of these people are "professionals" who create websites for clients. These customers naturally get upset when their inboxes start filling up with spam. Hosting companies will no doubt be even more unhappy when they disable a customer's domain name because they can't stand insecure scripts on their servers.

The moral of this story is not that PHP is insecure; nor is it that everyone needs to be a security expert using PHP. It is important to understand the Basic Principle of PHP security: User input must be checked before it is processed. You'll find that this will be a theme throughout this book. With very little effort, most security risks can be eliminated.

Probably the most worrying aspect is that more than five years after this issue was first revealed, I still see many people using insecure email 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 the remedies suggested by the script's author or other experts.

The above is about how difficult it is to use and learn PHP. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template