Learning Note: Planing the Class ' s features--from:uploading Files securely with PHP

Source: Internet
Author: User

1. What is class?

Class is a set of related variables and functions;

In class, variables are called attributes, and functions are called methods.

Properties and methods have three features: public, protected, private, and their popular explanations are as follows:

    • Public: Common, public, this attribute or method everyone can use ;
    • Protected: Protected, this property or method only I and my children and grandchildren (inheritance) can use ;
    • Private: This is Lao Tzu's personal, son grandson can not use ;

If you want to use a class, you usually need to instantiate (and also have a static access method), and the class instantiation gets an object

2, the principle of design class (only for this course):
    • Must is easy to resuse;
    • Must check size (There is max_file_size in the form, but that is easy to get around, so check the size in the script)
    • Should restrict permitted types or neutralize risky ones;
    • Clean up filenames and optionally prevent overwriting;
    • Handle multiple uploads;
    • Use a name space (see below) to avoid conflicts with other scripts;
    • Inform the user of the outcome;
    • Helper methods;

3. Namespaces

Popularly speaking, the namespace is like a folder, class is the equivalent of a file, we can put the same name of the class into a different name space, so do not have to write a long long class file name to avoid the file name conflict. Have time to look for more detailed information, no longer expand here.

Learning Note: Planing the Class ' s features--from:uploading Files securely with PHP

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.