我遇到了如何在不修改父代码的情况下使用PHP来中断或结束父函数的执行的挑战
除了die()之外,我无法找出任何解决方案; 在子节点中,它将结束所有执行,因此在父函数调用之后的任何内容都将结束.有任何想法吗?
代码示例:
function victim() {
echo "I should be run";
killer();
echo "I should not";
}
function killer() {
//code to break parent here
}
victim();
echo "This should still run";
Run Code Online (Sandbox Code Playgroud)