php – 无法在exit()内调用函数

在commons.PHP中定义了一个函数

desktop.PHP -> include commons.PHP
    |
    |
   \|/
    include MODULES.'mod.PHP'

我可以在任何我想要的地方调用我的自定义函数,但不能在if内部的出口内调用.调用函数代码不会出现:

Mod.PHP

....
$error = MysqL_error();

if($_ADM['id_user']==1) {
    if(!empty($error)) {
        $debug = array(
                    'message' => "sql Error in infography_edit module.",
                    'line'    => '79',
                    'error'   => $error,
                    'sql'     => $sql
                );
        //exit(myPrint($debug)); //Calling here myPrint does not work
          exit(print_r($debug)); //This works
     }
 }

 $test = array('alex');
 exit(myPrint($debug)); //Calling here myPrint works

....

// The output error: Call to undefined function myPrint()

我只是无法理解为什么上面的代码之外的任何其他地方工作,但不在其中而不在里面再次定义它

UPDATE

这样做,似乎也不起作用:

myPrint($debug);
exit();
// The output error: Call to undefined function myPrint()

UPDATE2

desktop.PHP文件

> require(LIBS.’commons.PHP’);
>常见的HTML
>包含模块

包含桌面代码键盘http://codepad.org/hn8QlHQ9

解决方法:

怎么样的解决方法

function my_exit($msg){
   echo $msg;
   exit(1);  //Return code of the script, useful for cli scripts
}

//...
my_exit("Show message");
//...

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...