12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- /**
- * dir :搜索目录
- * depth :深度
- */
- function get_sub_dir ( $dir, $depth=1 ) {
- if( !is_dir($dir) ) {
- return false;
- }
- $dh = opendir($dir);
- $dir_arr = [];
- if($dh){
- while(($file = readdir($dh)) !== false){
- $or_depth = $depth;
- if($file == '.' || $file == '..' || $file == '.git') {
- continue;
- }
- $sub_dir = $dir . DIRECTORY_SEPARATOR . $file;
- if( !is_dir($sub_dir) ){
- continue;
- }
- // 读出子目录
- if( $depth > 1){
- $dir_arr[$file] = get_sub_dir($sub_dir, --$depth);
- }else{
- $dir_arr[] = $file;
-
- }
- $depth = $or_depth;
- }
- closedir($dh);
- }
- return $dir_arr;
- }
- // github datav 示例
- $datav_demos = get_sub_dir(__DIR__.'/demo');
- // gitee datav 示例
- $gitee_dir = __DIR__ . '/gitee-datav/';
- $gitee_demos = get_sub_dir($gitee_dir, 2);
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>DataV 大屏示例</title>
- </head>
- <body>
- <div style="width:50%;height:100%;margin-left:30%;text-align:left;">
- <h3>DataV 大屏示例</h3>
- <?php foreach($datav_demos as $datav){ ?>
- <p><a target="_blank" href="/demo/<?php echo $datav; ?>/dist/"><?php echo $datav; ?></a><p>
- <?php } ?>
- <h3>Gitee DataV 大屏示例</h3>
- <?php foreach($gitee_demos as $key => $gitee){ ?>
- <dl>
- <dh><?php echo $key; ?></dh>
- <?php foreach($gitee as $val){ ?>
- <dd>
- <a target="_blank" href="/gitee-datav/<?php
- $path = $key.'/'.$val;
- if($val == '大数据医疗') {
- $path .= '/views/';
- }
- if($val == '综合分析平台') {
- $path .= '/pages/';
- }
- if($val == '厅店效能大屏监控看板') {
- $path .= '/page/';
- }
- if($val == '舆情分析') {
- $path .= '/public.html';
- }
- echo $path;
- ?>">
- <?php echo $val; ?></a>
- </dd>
- <?php } ?>
- <dl>
- <?php } ?>
- </div>
- </body>
- </html>
|