if (!defined (' in_ecs '))--defined to determine if the constant ' in_ecs ' exists---define is the definition constant
{
Die (' Hacking attempt '); --Die Stop program, return parameter ' Hacking attempt '
}
Error_reporting (E_all); --Report all errors
if (__file__ = = ")--the full path and file name of the currently running file. If used in the included file, returns the file name that is included. This is a magic variable (pre-defined constant) test code : echo __file__;//output F:\www\test.php
{
Die (' Fatal error code:0 '); --Die Stop program, return parameter 'Fatal error code:0'
}
/* Get the root directory where the current ecshop is located */
Define (' Root_path ', str_replace (' includes/init.php ', ' ', str_replace (' \ \ ', '/', __file__))); The--str_replace () function replaces some other characters in a string with a string. echo str_replace("world","John","Hello world!")
; Output Hello john!
if (!file_exists (Root_path. ' Data/install.lock ') &&!file_exists (Root_path. The ' Includes/install.lock ')--file_exists () function checks whether a file or directory exists.
&&!defined (' No_check_install '))
{
Header ("Location:./install/index.php\n"); The--header () function sends the original HTTP header to the client.
Exit --die Alias, stop program
}
/* Initialization settings */--ini_set is used to set the value of php.ini, which takes effect when the function is executed, and the settings expire after the script finishes. You can modify the configuration without opening the php.ini file, which is convenient for virtual space.
@ini_set (' Memory_limit ', ' 64M '); --' menory_limit ': Sets the maximum number of bytes of memory that a script can request, which helps write bad scripts that consume the available memory on the server. The @ symbol means no output error.
@ini_set (' Session.cache_expire ', 180); --session.cache_expire ': Specifies a time limit (minutes) for the session page to be saved in the client cache for 180 minutes. If Session.cache_limiter=nocache is set, the settings here are not valid.
@ini_set (' Session.use_trans_sid ', 0);
----------------------------------------------
--' session.use_trans_sid ': whether to display the SID (session ID) in the URL using plaintext, which is forbidden by default because it poses a security risk to your users:
1. The user may tell other people about URLs that contain valid SIDS through EMAIL/IRC/QQ/MSN and other means.
2. URLs that contain valid SIDS may be saved on the public computer.
3. Users may save URLs with immutable SIDs in their favorites or browsing history. URL-based session management is always more risky than cookie-based session management, so it should be disabled.
-----------------------------------------------
@ini_set (' session.use_cookies ', 1); --' session.use_cookies ': whether to use a cookie to save the session ID on the client;
@ini_set (' Session.auto_start ', 0); --' session.auto_start ': whether automatically open session processing, set to 1 o'clock, the program does not have to session_start () to manually open the session can also use the session,
@ini_set (' display_errors ', 1); --' display_errors ': Sets the category of the error message.
1-1-1 Learning include-init.php