本文整理汇总了PHP中HC_Lib::list_recursive方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Lib::list_recursive方法的具体用法?PHP HC_Lib::list_recursive怎么用?PHP HC_Lib::list_recursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Lib
的用法示例。
在下文中一共展示了HC_Lib::list_recursive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_recursive
static function list_recursive($dirname)
{
$return = array();
$this_subfolders = HC_Lib::list_subfolders($dirname);
foreach ($this_subfolders as $sf) {
$subfolder_return = HC_Lib::list_recursive($dirname . '/' . $sf);
foreach ($subfolder_return as $sfr) {
$return[] = $sf . '/' . $sfr;
}
}
$this_files = HC_Lib::list_files($dirname);
$return = array_merge($return, $this_files);
return $return;
}
示例2: dirname
<?php
/* test file */
include_once dirname(__FILE__) . '/hclib/hc_lib.php';
$distdir = 'd:\\www\\_dist';
$new = $_GET['new'];
$old = $_GET['old'];
$new_dir = $distdir . '/' . $new;
$old_dir = $distdir . '/' . $old;
$new_listing = HC_Lib::list_recursive($new_dir);
$old_listing = HC_Lib::list_recursive($old_dir);
$added = array_diff($new_listing, $old_listing);
$deleted = array_diff($old_listing, $new_listing);
$same = array_intersect($new_listing, $old_listing);
$changed = array();
foreach ($same as $f) {
$old_hash = md5(file_get_contents($old_dir . '/' . $f));
$new_hash = md5(file_get_contents($new_dir . '/' . $f));
if ($new_hash != $old_hash) {
$changed[] = $f;
}
}
if ($added) {
echo "ADDED:<br>";
echo "====<br>";
foreach ($added as $f) {
echo $f . '<br>';
}
echo '<br>';
}
if ($deleted) {