PHP spam code features _ PHP Tutorial

Source: Internet
Author: User
Introduction to features of PHP spam code. When developing a program, we often collect a lot of program code from other people on the internet. but how can we select a good program code to solve the problem? When developing a program, we often collect a lot of program code from other people on the internet. but how can we select a good program code to solve the problem? Next we will introduce you

If you are not familiar with the software to be modified, I suggest you take a good look at the software before making a decision. So how can we identify this as spam code without in-depth research? Here are 10 signs of spam code for your reference.

PHP spam code 1. try to transform the object-oriented model or modify the characteristics of a PHP language

If you find a class named Object, it is very likely that the author of the software tries to transform the object-oriented model (probably because he does not know the object-oriented model ), we can expect that his modifications are not limited to this. In this case, please turn off your phone and hide it!

PHP spam code 2. contains custom global variables

Search for the global keyword or $ GLOBALS variable in the code. if the following code is found:

Global $ database, $ my, $ mainframe;

This is the notorious global variable. If you can tell what the last two global variables represent, I guess you are familiar with my code, or you have supernatural power. It would be amazing if you could tell me which code will use them! In short, stay away from it.

PHP spam Code 3. HTML and SQL

Looking for the HTML code and SQL statement in the code, you should be able to quickly identify whether the code should appear here. If you find HTML and SQL in a file, congratulations! you found the worst software!

PHP spam code 4, too bloated class

Search for the three largest class files to see if the class name has clear functions? Let's see if its methods are related to each other? If not, scream and leave!

PHP spam code 5. a large number of public or static variables

If you find that many variables are defined as "public static", increase your offer by three times. I don't need to explain the reason.

PHP spam code 6. multi-layer inheritance

We should try to avoid inheritance between more than two layers. I spent a lot of time processing objects with too many irrelevant behaviors. If you know how to use multi-layer inheritance, I will invite you to beer.

PHP spam code 7. try to use the design pattern (just try)

To know whether the author of the code uses the design pattern, you only need to retrieve the most common ones, such as factory, decorator, and strategy). If there is, you can quickly identify whether the author will actually use these design patterns, or just want to make the code look interesting. If it is the latter, leave quickly.

PHP spam code 8. program disorder at different error levels

A sound application should be able to run properly at various error levels. Use/error_level (. *)/to check whether the error level has been modified in the code. If yes, change to E_STRICT and run it again.

PHP spam code 9. there is a directory called core.

When the entire application depends on some code to run, it is a good way to put the heap of code into a directory called core. However, in addition to the directory name, this method tends to indicate poor design.

PHP spam code 10. use your own template language

Fear is essential to this situation. Because these guys are trying to create their own wheels! If you are not careful about this, you will find that all your good days are spent on simulating a for loop.


Why ?...

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.