当前位置: 首页>>代码示例>>PHP>>正文


PHP Dir::tree方法代码示例

本文整理汇总了PHP中Dir::tree方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::tree方法的具体用法?PHP Dir::tree怎么用?PHP Dir::tree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dir的用法示例。


在下文中一共展示了Dir::tree方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: select_tpl

 public function select_tpl()
 {
     //模板目录
     $stylePath = ROOT_PATH . 'template/' . C("WEB_STYLE") . '/';
     $path = Q("request.path", $stylePath);
     $file = Dir::tree($path, "html");
     foreach ($file as $n => $v) {
         if ($v['type'] == 'dir') {
             $file[$n]['path'] = $v['path'];
         } else {
             $file[$n]['path'] = str_replace($stylePath, '', $v['path']);
         }
     }
     $history = "";
     if ($dir = Q("get.path")) {
         if ($dir == $stylePath) {
             $history = "";
         } else {
             $history = __METH__ . '&path=' . dirname($dir);
         }
     }
     $this->assign("history", $history);
     $this->assign("file", $file);
     $this->display();
 }
开发者ID:jyht,项目名称:v5,代码行数:25,代码来源:TemplateSelectControl.class.php

示例2: getFileList

 public function getFileList()
 {
     //风格目录
     $stylePath = ROOT_PATH . 'template/' . C("WEB_STYLE") . '/';
     $path = Q("request.path", '', "urldecode");
     if ($path) {
         $history = __ACTION__ . '&path=' . urlencode(dirname($path));
         $dir = $path;
     } else {
         $history = '';
         $dir = $stylePath;
     }
     $file = Dir::tree($dir, "html");
     foreach ($file as $n => $v) {
         if ($v['type'] == 'dir') {
             $file[$n]['url'] = __ACTION__ . '&path=' . urlencode($v['path']);
         } else {
             $startPos = strrpos($stylePath, C("WEB_STYLE")) + strlen(C("WEB_STYLE")) + 1;
             $file[$n]['path'] = substr($v['path'], $startPos);
         }
     }
     $this->assign('history', $history);
     $this->assign('file', $file);
     echo $this->fetch();
     exit;
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:26,代码来源:TemplateSelectController.class.php

示例3: styleList

 public function styleList()
 {
     $style = array();
     $dirs = Dir::tree('template');
     foreach ($dirs as $tpl) {
         $xml = $tpl['path'] . '/config.xml';
         if (!is_file($xml)) {
             continue;
         }
         if (!($config = Xml::toArray(file_get_contents($xml)))) {
             continue;
         }
         $tpl['name'] = isset($config['name']) ? $config['name'][0] : '';
         //模型名
         $tpl['author'] = isset($config['author']) ? $config['author'][0] : '';
         //作者
         $tpl['image'] = isset($config['image']) ? __ROOT__ . '/template/' . $tpl['filename'] . '/' . $config['image'][0] : __CONTROLLER_TPL__ . '/img/preview.jpg';
         //预览图
         $tpl['email'] = isset($config['email']) ? $config['email'][0] : '';
         //邮箱
         $tpl['current'] = C("WEB_STYLE") == $tpl['filename'] ? 1 : 0;
         //正在使用的模板
         $style[] = $tpl;
     }
     $this->assign('style', $style);
     $this->display();
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:27,代码来源:TemplateStyleController.class.php

示例4: set_db

 public function set_db()
 {
     if (IS_POST) {
         if (!mysql_connect($_POST['DB_HOST'], $_POST['DB_USER'], $_POST['DB_PASSWORD'])) {
             $this->error('数据库帐号或密码错误');
         }
         //创建数据库
         mysql_query("CREATE DATABASE IF NOT EXISTS " . $_POST['DB_DATABASE'] . ' CHARSET UTF8');
         //数据库连接正常
         C($_POST);
         $db_prefix = $_POST['DB_PREFIX'];
         $db = M();
         //导入数据
         $files = Dir::tree('db');
         foreach ($files as $f) {
             require $f['path'];
         }
         //修改配置文件
         $config = array('DB_HOST' => $_POST['DB_HOST'], 'DB_PORT' => $_POST['DB_PORT'], 'DB_USER' => $_POST['DB_USER'], 'DB_PASSWORD' => $_POST['DB_PASSWORD'], 'DB_DATABASE' => $_POST['DB_DATABASE'], 'DB_PREFIX' => $_POST['DB_PREFIX']);
         $data = "<?php\nif(!defined('HDPHP_PATH'))exit;\nreturn " . var_export($config, true) . ";\n?>";
         file_put_contents('../data/config/db.inc.php', $data);
         //更新管理员信息
         $db->table('admin')->save(array('aid' => 1, 'username' => $_POST['username'], 'password' => md5($_POST['password'])));
         touch('lock.php');
         $this->root = dirname(__ROOT__);
         $this->display('success');
     } else {
         $this->display();
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:30,代码来源:IndexControl.class.php

示例5: prepared

 public function prepared()
 {
     $modules = Db::table('modules')->lists('name');
     $dirs = Dir::tree('addons');
     //本地模块
     $locality = [];
     foreach ($dirs as $d) {
         if ($d['type'] == 'dir' && is_file($d['path'] . '/manifest.xml')) {
             $xml = Xml::toArray(file_get_contents($d['path'] . '/manifest.xml'));
             //去除已经安装的模块
             if (!in_array($xml['manifest']['application']['name']['@cdata'], $modules)) {
                 //预览图片
                 $x['cover'] = is_file($d['path'] . '/cover.jpg') ? $d['path'] . '/cover.jpg' : 'resource/images/nopic_small.jpg';
                 $x['name'] = $xml['manifest']['application']['name']['@cdata'];
                 $x['title'] = $xml['manifest']['application']['title']['@cdata'];
                 $x['version'] = $xml['manifest']['application']['version']['@cdata'];
                 $x['detail'] = $xml['manifest']['application']['detail']['@cdata'];
                 $x['author'] = $xml['manifest']['application']['author']['@cdata'];
                 $x['locality'] = !is_file('addons/' . $x['name'] . '/cloud.hd') ? 1 : 0;
                 $locality[$x['name']] = $x;
             }
         }
     }
     return view()->with('locality', $locality);
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:25,代码来源:Module.php

示例6: selectTemplate

 /**
  * 选择模板
  */
 public function selectTemplate()
 {
     if (!($dir = Q('dir'))) {
         $dir = 'Template/' . C('WEB_STYLE');
     }
     $file = Dir::tree($dir, 'html');
     $this->assign('id', Q('id'));
     $this->assign('file', $file);
     $this->display();
 }
开发者ID:suhanyujie,项目名称:spider,代码行数:13,代码来源:CategoryController.class.php

示例7: index

 public function index()
 {
     $file = Dir::tree(APP_PATH . "backup");
     $dir = array();
     foreach ($file as $f) {
         if (is_dir($f['path'])) {
             $dir[] = $f;
         }
     }
     $this->assign("dir", $dir);
     $this->display();
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:12,代码来源:AdminController.class.php

示例8: index

 public function index()
 {
     $data = Dir::tree('template');
     // p($data);
     $dirs = array();
     foreach ($data as $d) {
         if (is_file($d['path'] . '/config.php')) {
             $d['active'] = $d['filename'] == C('web.style') ? 'class="active"' : '';
             $d = array_merge($d, require $d['path'] . '/config.php');
             $dirs[] = $d;
         }
     }
     View::with('dirs', $dirs)->make();
 }
开发者ID:arnold1119,项目名称:cms,代码行数:14,代码来源:TemplateController.php

示例9: index

 public function index()
 {
     $data = Dir::tree('template');
     // p($data);
     $array = [];
     foreach ($data as $k => $v) {
         if ($v['filename'] == C('web2.style')) {
             $v['class'] = "class='active'";
         } else {
             $v['class'] = "";
         }
         // $array[] = $v;
         if (is_file($v['path'] . '/config.php')) {
             $array[] = array_merge($v, require $v['path'] . '/config.php');
         }
     }
     // p($array);
     View::with('data', $array)->make();
 }
开发者ID:arnold1119,项目名称:cms,代码行数:19,代码来源:TemplateController.php

示例10: plugin_list

 /**
  * 插件列表
  */
 public function plugin_list()
 {
     $Model = K("Plugin");
     $dir = Dir::tree('hd/Plugin');
     $plugin = array();
     if (!empty($dir)) {
         foreach ($dir as $d) {
             //插件应用名
             $app = $d['name'];
             $conf = (require "hd/Plugin/{$app}/Config/config.php");
             $conf['app'] = $app;
             //转为小写,方便视图调用
             $conf = array_change_key_case_d($conf);
             $plugin[$d['name']] = $conf;
             $plugin[$d['name']]['dirname'] = $app;
             //是否安装
             $installed = $Model->where("app='{$app}'")->find();
             $plugin[$d['name']]['installed'] = $installed ? 1 : 0;
         }
     }
     $this->assign("plugin", $plugin);
     $this->display();
 }
开发者ID:jyht,项目名称:v5,代码行数:26,代码来源:PluginControl.class.php

示例11: recoveryInit

 public function recoveryInit($config)
 {
     F('_recovery_', '[del]');
     if (!is_dir($config['dir'])) {
         $this->error = '目录不存在';
         return false;
     }
     foreach (Dir::tree($config['dir']) as $f) {
         if ($f['basename'] == 'config.php' || $f['basename'] == 'structure.php' || $f['basename'] == 'lock.php') {
             //不运行执行的文件
             continue;
         } else {
             $file[] = $f['path'];
         }
     }
     $cache['config'] = $config;
     $cache['file'] = $file;
     $cache['totalfile'] = count($file);
     F('_recovery_', $cache);
     //还原表结构
     require $config['dir'] . '/structure.php';
     return true;
 }
开发者ID:arnold1119,项目名称:cms,代码行数:23,代码来源:Backup.php

示例12: backList

 /**
  * 备份列表
  * @return [type] [description]
  */
 public function backList()
 {
     $dirs = Dir::tree('Backup');
     $this->assign('dirs', $dirs);
     $this->display();
 }
开发者ID:www2511550,项目名称:ECSHOP,代码行数:10,代码来源:BackupController.class.php

示例13: index

 public function index()
 {
     $data = Dir::tree('Backup');
     View::with('data', $data)->make();
 }
开发者ID:ChenHuaPHP,项目名称:ZOLshop,代码行数:5,代码来源:BackupController.php

示例14: show_dir

 public function show_dir()
 {
     $dirName = Q("get.dir_name") ? Q("get.dir_name", '', "urldecode") : 'template/' . C("WEB_STYLE");
     $this->dirs = Dir::tree($dirName, 'html');
     $this->display();
 }
开发者ID:jyht,项目名称:v5,代码行数:6,代码来源:TemplateStyleControl.class.php

示例15: index

 public function index()
 {
     $data = Dir::tree('backup');
     $this->data = $data;
     $this->display();
 }
开发者ID:jyht,项目名称:v5,代码行数:6,代码来源:RecoveryControl.class.php


注:本文中的Dir::tree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。