有没有办法立即停止
PHP代码执行?
我知道exit,但它明确指出:
Terminates execution of the script. Shutdown functions and object destructors will always be executed even if exit is called.
所以我想要实现的是在我调用exit或者其他任何操作时停止PHP代码执行.
任何帮助?
编辑:詹森答复后
试用1:
function newExit() {
__halt_compiler();
}
echo "start";
newExit();
echo "you should not see this";
显示致命错误:__HALT_COMPILER()只能从预期最外层的范围使用.
试用2:
function newExit() {
include 'e.php';
}
echo "start";
newExit();
echo "you should not see this";
e.php只包含__halt_compiler();
这显示startyou不应该看到这一点
编辑:为什么要这样做?
我正在处理一个包含专有库(通过虚拟主机配置文件(不需要访问权限))作为加密代码的应用程序.是一种用于安全目的的监控库.其中一个行为是注册一些关闭功能来记录实例状态(将数据保存到数据库)
我想做的是根据(远程IP)为某些特定条件禁用此日志记录