本文整理汇总了PHP中Dir::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::getList方法的具体用法?PHP Dir::getList怎么用?PHP Dir::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dir
的用法示例。
在下文中一共展示了Dir::getList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$list = D('SysConf')->where("status=1 and group_id > 0 and is_show = 1")->order("sort asc")->findAll();
$conf_list = array();
//用于输出分组格式化后的数组
foreach ($list as $k => $v) {
if ($v['name'] == 'DEFAULT_LANG') {
$lang_list = Dir::getList(LANG_PATH);
$v['val_arr'] = array();
foreach ($lang_list as $lang_item) {
if ($lang_item != '.' && $lang_item != '..') {
$v['val_arr'][] = $lang_item;
}
}
} elseif ($v['name'] == 'SITE_TMPL') {
$tmpl_list = Dir::getList(FANWE_ROOT . 'tpl');
$v['val_arr'] = array();
foreach ($tmpl_list as $tmpl_item) {
if ($tmpl_item != '.' && $tmpl_item != '..') {
$v['val_arr'][] = $tmpl_item;
}
}
} else {
$v['val_arr'] = explode(",", $v['val_arr']);
}
$conf_list[L("SYSCONF_GROUP_" . $v['group_id'])][$k] = $v;
}
$this->assign("conf_list", $conf_list);
$this->display();
}
示例2: sp_get_url_route
function sp_get_url_route()
{
$apps = Dir::getList(SPAPP);
$host = (is_ssl() ? 'https' : 'http') . "://" . $_SERVER['HTTP_HOST'];
$routes = array();
foreach ($apps as $a) {
if (is_dir(SPAPP . $a)) {
if (!(strpos($a, ".") === 0)) {
$navfile = SPAPP . $a . "/nav.php";
$app = $a;
if (file_exists($navfile)) {
$navgeturls = (include $navfile);
foreach ($navgeturls as $url) {
//echo U("$app/$url");
$nav = file_get_contents($host . U("{$app}/{$url}"));
$nav = json_decode($nav, true);
if (!empty($nav) && isset($nav['urlrule'])) {
if (!is_array($nav['urlrule']['param'])) {
$params = $nav['urlrule']['param'];
$params = explode(",", $params);
}
sort($params);
$param = "";
foreach ($params as $p) {
$param .= ":{$p}/";
}
$routes[strtolower($nav['urlrule']['action']) . "/" . $param] = $nav['urlrule']['action'];
}
}
}
}
}
}
return $routes;
}
示例3: edit
public function edit()
{
$arr = Dir::getList(FANWE_ROOT . "/tpl/");
foreach ($arr as $item) {
if (strpos($item, '.') === FALSE) {
$themes[] = $item;
}
}
$adv = D("advPosition")->field("id,name")->findAll();
$this->assign("adv", $adv);
$this->assign("themes", $themes);
parent::edit();
}
示例4: initModule
private function initModule()
{
$actions = array('index' => 1, 'add' => 1, 'insert' => 0, 'update' => 0, 'remove' => 0, 'editfield' => 0, 'togglestatus' => 0);
$custom_modules = array('Cache' => array(), 'Index' => array());
$disable_modules = array('Fanwe', 'Common', 'Public');
$files = Dir::getList(ADMIN_PATH . '/Lib/Action/');
//$modules = D('RoleNode')->where('auth_type = 1')->select();
$exists_modules = array();
foreach ($files as $file) {
if ($file != '.' && $file != '..' && stripos($file, 'Action.class.php') !== false) {
$module = str_ireplace('Action.class.php', '', $file);
if (!in_array($module, $disable_modules)) {
if (D("RoleNode")->where("module='" . $module . "' AND action=''")->count() == 0) {
//增加该模块授权
$module_data = array();
$module_data['status'] = 1;
$module_data['module'] = $module;
$module_data['module_name'] = L($module);
$module_data['auth_type'] = 1;
$module_data['is_show'] = 0;
$module_data['sort'] = 10;
D("RoleNode")->add($module_data);
if (array_key_exists($module, $custom_modules)) {
$module_actions = $custom_modules[$module];
} else {
$module_actions = $actions;
}
foreach ($module_actions as $action => $is_show) {
//增加该模块操作授权
$action_data = array();
$action_data['module'] = $module;
$action_data['module_name'] = L($module);
$action_data['action'] = $action;
$action_data['action_name'] = L($module . '_' . $action);
$action_data['auth_type'] = 0;
$action_data['is_show'] = $is_show;
$action_data['status'] = 1;
$action_data['sort'] = 10;
if ($is_show) {
$action_data['nav_id'] = 3;
}
D("RoleNode")->add($action_data);
}
}
array_push($exists_modules, $module);
}
}
}
//删除多余的module
D("RoleNode")->where(array("module" => array("not in", $exists_modules), "action" => ''))->delete();
}
示例5: inport_db
public function inport_db()
{
//导入数据库
import("ORG.Io.Dir");
$path = './Backup/SQL/';
$fil = array('.', '..', '.svn');
$dir = Dir::getList($path);
$f = array_diff($dir, $fil);
$this->assign('list', $f);
$this->assign('path', $path);
$this->display();
}
示例6: spmy_export_menu
public function spmy_export_menu()
{
$menus = $this->Menu->order(array("app" => "ASC", "model" => "ASC", "action" => "ASC"))->select();
$menus_tree = array();
$apps = Dir::getList(SPAPP);
foreach ($apps as $a) {
if (is_dir(SPAPP . $a)) {
if (!(strpos($a, ".") === 0)) {
$menudir = SPAPP . $a . "/Menu";
Dir::del($menudir);
}
}
}
foreach ($menus as $m) {
$mm = $m;
unset($mm['app']);
unset($mm['model']);
unset($mm['id']);
unset($mm['parentid']);
$menus_tree[$m['app']][$m['model']][] = $mm;
}
foreach ($menus_tree as $app => $models) {
$menudir = SPAPP . $app . "/Menu";
foreach ($models as $model => $a) {
if (!file_exists($menudir)) {
mkdir($menudir);
}
file_put_contents($menudir . "/{$model}.php", "<?php\treturn " . var_export($a, true) . ";?>");
}
}
$this->display("export_menu");
}