在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
>包含模块