手机
当前位置:查字典教程网 >编程开发 >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自动获取目录下的模板的代码】相关文章:

为php4加入动态flash文件的生成的支持

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

php比较相似字符串的方法

PHP开发的9条经验总结

php对文件进行hash运算的方法

php快速查找数据库中恶意代码的方法

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

php实现的mongodb操作类

php删除指定目录的方法

给多个地址发邮件的类

精品推荐
分类导航