How to know if php script is called via require_once()?

后端 未结 11 985
旧巷少年郎
旧巷少年郎 2021-01-07 02:24

My webapp has a buch of modules. Each module has a \'main\' php script which loads submodules based on a query sent to the main module:

//file: clientes.php
         


        
11条回答
  •  盖世英雄少女心
    2021-01-07 02:44

    An alternative to defining a constant and checking it is to simply put the files that index.php includes outside of the document root area. That way the user can't directly access them via your web server at all. This is also obviously the most secure way, in case your web server has a configuration error in future that eg. displays PHP files as plain text.

提交回复
热议问题