ZenCart系统里面使用的常量有两种类型,一种是文件定义的常量,另一种是数据库里面定义的常量。
$use_cache = (isset($_GET['nocache']) ? false : true ) ;$configuration = $db->Execute('select configuration_key as cfgkey, configuration_value as cfgvalue from ' . TABLE_CONFIGURATION, '', $use_cache, 150); while (!$configuration->EOF) { /** * dynamic define based on info read from DB */ define(strtoupper($configuration->fields['cfgkey']), $configuration->fields['cfgvalue']);///定义数据库常量 $configuration->MoveNext();}$configuration = $db->Execute('select configuration_key as cfgkey, configuration_value as cfgvalue from ' . TABLE_PRODUCT_TYPE_LAYOUT);while (!$configuration->EOF) { /** * dynamic define based on info read from DB * @ignore */ define(strtoupper($configuration->fields['cfgkey']), $configuration->fields['cfgvalue']);//定义数据库常量 $configuration->movenext();}
这个文件是在初始化的时候执行了,所以在系统里面可以直接使用数据库里面的常量来取得他的值。比如STORE_NAME。 |