Do not want php files to be browsed separately?

Source: Internet
Author: User
I don't want the php file to be browsed separately. php splits the file into several files and uses include () reference during runtime. how to do this ------ solution ------------------ in index. define a constant in php, and then judge whether the constant has been defined in a separate small file. if not, exit the program. Define a constant: PHPcodedifineACCESStru does not want the php file to be browsed separately
For ease of processing, I split index. php into several files and reference it with include () during runtime. how can I do this?

------ Solution --------------------
Define a constant in index. php, and then judge whether the constant has been defined in a separate small file. if not, exit the program.
Define constants:
PHP code
Difine ACCESS = true;
------ Solution --------------------
You can also remove the execution permission of small files.
------ Solution --------------------
First floor
------ Solution --------------------
Cannot be accessed by direct URLs
If (basename ($ _ SERVER ['php _ SELF ']) = basename (_ FILE _) return;
// The content of the program file is as follows:
------ Solution --------------------
Place the include files outside the root directory of the document.

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.