PHP and some global variables
问题 require_once'modules/logger.php'; $Logger = new Logger(); require_once 'templates/list.php'; $Templates = new templatesList(); require_once 'widgets/list.php'; $Widgets = new widgetsList(); I use $Logger in templates/list.php and in widgets/list.php . $Templates I use in /widgets/list.php . The code above throws this error: Notice: Undefined variable: Logger in .../templates/list.php on line 99 Fatal error: Call to a member function toLog() on a non-object in .../templates/list.php on line 99