且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用include时无法直接访问脚本

更新时间:2023-12-03 08:01:28

实现此目的的基本方法是在应用程序中的某处(在加载database.php之前)有一行代码:

The basic way for going about this is somewhere in the application (prior to the loading of database.php) there is a line something along the lines of:

define( 'APPLICATION_LOADED', true );

在database.php中,对此进行检查,类似于:

In the database.php there is a check being performed against this, similar to:

if( !defined('APPLICATION_LOADED') || !APPLICATION_LOADED ) {
    die( 'No direct script access.' );
}

查看database.php以及它包含的任何文件以确定它是如何检查的查看脚本是否被直接访问。如果您想在脚本中包含该文件,则可以模仿必要的条件。

Look in database.php and whatever files it includes to determine how it is checking to see if the script is being directly accessed or not. Then you can mimic the conditions necessary if you would like to include that file in your script.