で定義された関数を持つ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()
上記のコードの外側の他の場所が機能する理由を理解することはできませんが、コードの内側で再度定義しないと内部では機能しません
アップデート
このようにすると、どちらも機能しないようです。
myPrint($debug);
exit();
// The output error: Call to undefined function myPrint()
UPDATE2
desktop.phpメインファイル:
- require(LIBS.'commons.php');
- 一般的なhtml
- モジュールを含める
デスクトップのコードを含むコードパッド:http://codepad.org/hn8QlHQ9