This is a function that I have never used. Most people do not need to use this function, so few people know its usefulness. Today, I read some related knowledge on stackoverflow and share it with you. Let's take a look at the official explanation: interrupt the execution of the compiler. It is often used to embed data in PHP scripts, similar to installation files. You can use constant _ COM
This is a function that I have never used. Most people do not need to use this function, so few people know its usefulness. Today, I read some related knowledge on stackoverflow and share it with you. Let's take a look at the official explanation: interrupt the execution of the compiler. It is often used to embed data in PHP scripts, similar to installation files. You can use constant _ COM
This is a function that I have never used. Most people do not need to use this function, so few people know its usefulness. Today, I read some related knowledge on stackoverflow and share it with you.
First look at the official explanation:
Interrupt the execution of the compiler. It is often used to embed data in PHP scripts, similar to installation files.
You can use the constant _ COMPILER_HALT_OFFSET _ to obtain the position of the Start byte of the data. The constant is only defined in the file where _ halt_compiler is used.
Let's look at the code at both ends and their running results:
Vagrant @ precise64:/var/www/test/misc $ cat exit. php
See the difference!
Both the exit () and _ halt_compiler () Methods exit code execution, but the file using exit () will be interpreted as the end of the file. If a syntax error occurs, an error will be reported, __halt_compiler () will not explain the subsequent code. Therefore, you can add anything you want (such as your bank card account and password) after _ halt_compiler () without thinking about the syntax.
In the file where _ halt_compiler () appears, a variable _ COMPILER_HALT_OFFSET __is generated. The value is the next character at the location where the code is interrupted, it is officially referred to as "the location of the Data start Byte ";
See the following code:
Vagrant @ precise64:/var/www/test/misc $ cat halt_compile.php
Use the fseek method to directly move to the starting position of "the installation data (eg. tar, gz, PHP, etc.)" and then read the content.
Original article address: php miscellaneous functions (MISC) _ halt_compiler (). Thank you for sharing it with me.