我有一个php文件,我将作为一个包含专门使用.因此,当我通过输入URL而不是包含它来直接访问它时,我想抛出一个错误而不是执行它.
基本上我需要在php文件中进行如下检查:
if ( $REQUEST_URL == $URL_OF_CURRENT_PAGE ) die ("Direct access not premitted");
是否有捷径可寻?
php include-guards include
有没有办法阻止用户查看文件但仍然使用它包含在PHP中的另一个文件中?
php file include
include ×2
php ×2
file ×1
include-guards ×1