예제 #1
0
 /**
  * 列出前台风格的模型视图界面
  */
 private function _listModaltpl()
 {
     $dir = array();
     $front_config = (include PATH_ROOT . '/config/app.php');
     $style = $front_config['TPL_DIR'] . '/' . $front_config['TPL_STYLE'];
     $dir = dir::tree($style . '/model');
     return $dir;
 }
예제 #2
0
 /**
  * 数据恢复
  */
 public function dbRestore()
 {
     $link = mysql_connect(C('DB_HOST'), C('DB_USER'), C('DB_PASSWORD')) or die('MySQL连接失败 : ' . mysql_error());
     mysql_query("SET NAMES UTF8");
     mysql_select_db(C('DB_DATABASE'), $link) or die('无法选择数据库 : ' . mysql_error());
     $path = PATH_ROOT . '/caches/db/' . $_GET['folder'];
     $sql = dir::tree($path, array('sql'));
     foreach ($sql as $value) {
         $content = file_get_contents($value['path']);
         $sql_item = array_filter(array_map('trim', explode('---------houdunwang-------------', $content)));
         if (!empty($sql_item)) {
             foreach ($sql_item as $item) {
                 mysql_query($item);
             }
         }
     }
     $this->success('数据导入成功!', 'dbTool');
 }