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
> 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");
//...