Basically you need to create a class to act w3coded php autoloading as a wrapper for the constants but by doing so w3coded php autoloading it allows __autoload() to work as you w3coded php autoloading intended.,This, however, does not work. The w3coded php autoloading __autoload is not called for the constant as it w3coded php autoloading is with classes, leaving me with a Undefined w3coded php autoloading constant error., w3coded php autoloading w3coded php autoloading Wouldn't have worked anyway. w3coded php autoloading Just gave it a try in 5.2 and, of course, the w3coded php autoloading line triggering the error has already been w3coded php autoloading processed so the constant definition isn't w3coded php autoloading picked up until the next line. Hope you get a w3coded php autoloading solution. w3coded php autoloading – Mike Jan w3coded php autoloading 21 '10 at 15:59 w3coded php autoloading w3coded php autoloading ,You can write a custom w3coded php autoloading error handler to catch the warning and load in w3coded php autoloading the appropriate constants file.
Try this (worked on my server):
<?php
namespace config\database\mysql;
class Mysql
{
const HOST = 'localhost';
const USER = 'testusr';
const PASSWORD = 'testpwd';
const NAME = 'testdb';
}
?>
<?php
function __autoload($className)
{
echo "Autoload: {$className}\n";
$class_file = str_replace('\\', '/', $className) . ".php";
if(file_exists($class_file)) {
include $class_file;
}
}
echo config\database\mysql\Mysql::HOST;
?>
Last Update : 2023-09-22 UTC 13:53:24 PM
Last Update : 2023-09-22 UTC 13:53:05 PM
Last Update : 2023-09-22 UTC 13:52:53 PM
Last Update : 2023-09-22 UTC 13:52:41 PM
Last Update : 2023-09-22 UTC 13:52:34 PM
Last Update : 2023-09-22 UTC 13:52:00 PM
Last Update : 2023-09-22 UTC 13:51:49 PM