手机
当前位置:查字典教程网 >编程开发 >php教程 >php自动获取目录下的模板的代码
php自动获取目录下的模板的代码
摘要:目录下必须有default.gif(此图为模板缩略图)的才为合法的模板复制代码代码如下:functionget_template(){$te...

目录下必须有default.gif(此图为模板缩略图)的才为合法的模板

复制代码 代码如下:

function get_template ()

{

$template = array ();

$dir = CMS_ROOT.'/tpl/';

$n = 0;

if (is_dir($dir)) {

if ($dh = opendir($dir)) {

while (($file = readdir($dh)) !== false) {

if ($file =='.' or $file == '..' or $file == '.svn')

{

continue;

}

if (is_dir ($dir.$file))

{

if (file_exists ($dir.$file.'/default.gif'))

{

$template[$n]['dir'] = $file;

$template[$n]['pic'] ='/tpl/'.$file.'/default.gif';

}

}

$n++;

}

closedir($dh);

}

}

return $template;

}

【php自动获取目录下的模板的代码】相关文章:

php计算整个目录大小的方法

自动跳转中英文页面

xml+php动态载入与分页

php实现TCP端口检测的方法

php按单词截取字符串的方法

在PHP中使用灵巧的体系结构

给多个地址发邮件的类

PHP滚动日志的代码实现

php使用cookie实现记住用户名和密码实现代码

php编写批量生成不重复的卡号密码代码

精品推荐
分类导航