本文整理匯總了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) {