$loader->setConfigs($configs); $class_list = array('Smarty', 'Logs', 'MySQL', 'Code', 'JSSDK', 'WechatResponse'); $loader->includeClass($class_list); $script_list = array('configs', 'functions', 'lang', 'member', 'transaction', 'wechat'); $loader->includeScript($script_list); //初始化数据库链接 global $db; $db = new MySQL(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DBNAME, DB_PREFIX); $debug_mode = true; //开启此项将关闭Smarty缓存模式,并开启日志跟踪 //初始化日志对象 global $log; $log_file = date('Ymd') . '.log'; $log = new Logs($debug_mode, $log_file); //读取网站设置 $get_sysconf = 'select `key`,`value` from ' . $db->table('sysconf'); global $config; $config_tmp = $db->fetchAll($get_sysconf); foreach ($config_tmp as $tmp) { $config[$tmp['key']] = $tmp['value']; } //初始化smarty对象 global $smarty; $smarty = new Smarty(); $smarty->setCompileDir(ROOT_PATH . 'data/compiles'); $smarty->setTemplateDir(ROOT_PATH . 'themes/' . $config['themes']); $smarty->setCacheDir(ROOT_PATH . 'data/caches'); $smarty->setCacheLifetime(2); //设置缓存文件超时时间为1800秒 //Debug模式下每次都强制编译输出 if ($debug_mode) {
$loader->setConfigs($configs); $class_list = array('Smarty', 'Logs', 'MySQL', 'Code', 'PHPExcel'); $loader->includeClass($class_list); $script_list = array('configs', 'functions', 'lang', 'purview', 'member', 'account', 'wechat'); $loader->includeScript($script_list); //初始化数据库链接 global $db; $db = new MySQL(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DBNAME, DB_PREFIX); $debug_mode = true; //开启此项将关闭Smarty缓存模式,并开启日志跟踪 //初始化日志对象 global $log; $log_file = date('Ymd') . '.log'; $log = new Logs($debug_mode, $log_file); //读取网站设置 $get_sysconf = 'select `key`,`value` from ' . $db->table('sysconf'); global $config; $config_tmp = $db->fetchAll($get_sysconf); foreach ($config_tmp as $tmp) { $config[$tmp['key']] = $tmp['value']; } //初始化smarty对象 global $smarty; $smarty = new Smarty(); $smarty->setCompileDir(ROOT_PATH . 'control/data/compiles'); $smarty->setTemplateDir(ROOT_PATH . 'control/themes/'); $smarty->setCacheDir(ROOT_PATH . 'control/data/caches'); $smarty->setCacheLifetime(1800); //设置缓存文件超时时间为1800秒 //Debug模式下每次都强制编译输出 if ($debug_mode) {
<?php header("content-type:text/html;charset:utf-8"); require_once 'mysql.class.php'; $mysql = new MySQL('localhost', 'user', 'password', 'test'); echo '<pre>'; //获取表字段 //print_r($mysql->getFields('test')); //增 echo $mysql->data(array('name' => 'test', 'password' => '123456'))->table('test')->add(); //删 echo $mysql->table('test')->where('id=1')->delete(); //改 echo $mysql->table('test')->data(array('name' => 'bbbbbbbbbbbb'))->where('id<3')->update(); //查 print_r($mysql->table('test')->where('id=4')->select()); print_r($mysql->table('test')->order('id desc')->select()); // $mysql->query('select * from `test`'); $mysql->execute('update `test` set password = 123'); echo '</pre>'; echo '查询次数:' . $mysql->query_count . '<br>'; echo '查询时间:' . number_format(microtime(true) - $mysql->query_start_time, 10) . ' 秒<br>'; echo '错误信息:' . $mysql->error() . '<br>';
$loader->setConfigs($configs); $class_list = array('Smarty', 'Logs', 'MySQL', 'Code'); $loader->includeClass($class_list); $script_list = array('configs', 'functions', 'lang', 'purview', 'content', 'section', 'statistics'); $loader->includeScript($script_list); //初始化数据库链接 global $db; $db = new MySQL(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DBNAME, DB_PREFIX); $debug_mode = true; //开启此项将关闭Smarty缓存模式,并开启日志跟踪 //初始化日志对象 global $log; $log_file = date('Ymd') . '.log'; $log = new Logs($debug_mode, $log_file); //读取网站设置 $get_sysconf = 'select `key`,`value` from ' . $db->table('sysconf'); global $config; $config_tmp = $db->fetchAll($get_sysconf); if ($config_tmp) { foreach ($config_tmp as $tmp) { $config[$tmp['key']] = $tmp['value']; } } //初始化smarty对象 global $smarty; $smarty = new Smarty(); $smarty->setCompileDir(ROOT_PATH . 'data/compiles'); $smarty->setTemplateDir(ROOT_PATH . 'themes/' . $config['themes']); $smarty->setCacheDir(ROOT_PATH . 'data/caches'); $smarty->setCacheLifetime(1800); //设置缓存文件超时时间为1800秒
$loader->setConfigs($configs); $class_list = array('Smarty', 'Logs', 'MySQL', 'Code'); $loader->includeClass($class_list); $script_list = array('configs', 'functions', 'lang', 'business', 'transaction', 'member'); $loader->includeScript($script_list); //初始化数据库链接 global $db; $db = new MySQL(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DBNAME, DB_PREFIX); $debug_mode = true; //开启此项将关闭Smarty缓存模式,并开启日志跟踪 //初始化日志对象 global $log; $log_file = date('Ymd') . '.log'; $log = new Logs($debug_mode, $log_file); //读取网站设置 $get_sysconf = 'select `key`,`value` from ' . $db->table('sysconf'); global $config; $config_tmp = $db->fetchAll($get_sysconf); foreach ($config_tmp as $tmp) { $config[$tmp['key']] = $tmp['value']; } //初始化smarty对象 global $smarty; $smarty = new Smarty(); $smarty->setCompileDir(ROOT_PATH . 'pc/data/compiles'); $smarty->setTemplateDir(ROOT_PATH . 'pc/themes/' . $config['themes']); $smarty->setCacheDir(ROOT_PATH . 'pc/data/caches'); $smarty->setCacheLifetime(1800); //设置缓存文件超时时间为1800秒 //Debug模式下每次都强制编译输出 if ($debug_mode) {