本文整理汇总了PHP中file_list函数的典型用法代码示例。如果您正苦于以下问题:PHP file_list函数的具体用法?PHP file_list怎么用?PHP file_list使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file_list
function file_list($dir, $pattern = "")
{
$arr = array();
$dir_handle = opendir($dir);
if ($dir_handle) {
while (($file = readdir($dir_handle)) !== false) {
if ($file === '.' || $file === '..') {
continue;
}
$tmp = realpath($dir . '/' . $file);
if (is_dir($tmp)) {
$retArr = file_list($tmp, $pattern);
if (!empty($retArr)) {
$arr[] = $retArr;
}
} else {
if ($pattern === "" || preg_match($pattern, $tmp)) {
$arr[] = $tmp;
}
}
}
closedir($dir_handle);
}
return $arr;
}
示例2: file_list
function file_list($path)
{
require_once 'thinksaas/class.Diff.php';
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($path . "/" . $file)) {
file_list($path . "/" . $file);
} else {
$upfile = $path . "/" . $file;
$nfile = substr($path . '/' . $file, 18);
if (is_file($nfile)) {
//if(Diff::compareFiles($nfile, $upfile)){
if (copy($upfile, $nfile) === false) {
return '1';
exit;
//不可拷贝就返回1
}
//}
} else {
if (copy($upfile, $nfile) === false) {
return '1';
exit;
//不可拷贝就返回1
}
}
}
}
}
}
}
示例3: compile_markdown_files_metadata
function compile_markdown_files_metadata($folder, $output_file)
{
$data = array();
foreach (file_list($folder) as $file) {
$data[$file] = parse_file($file);
$data[$file]['link'] = generate_link($file);
unset($data[$file]['content']);
}
$data_before = <<<EOT
<?php
/*
===== This file is auto-generated. It contains the compiled metadata from the markdown. =====
*/
function compiled_metadata(\$file = null) {
\$data =
EOT;
$data_after = <<<EOT
;
\tif (\$file == null || !isset(\$data[\$file])) {
\t\treturn \$data;
\t} else {
\t\treturn \$data[\$file];
\t}
}
EOT;
$complete_data = $data_before . var_export($data, true) . $data_after;
$file_handle = fopen($output_file, "w");
if ($file_handle == false) {
die('Could not open compiled file to write.');
}
if (!fwrite($file_handle, $complete_data)) {
die('Could not write to file');
}
}
示例4: file_list
function file_list($dir, $fs = array())
{
$files = glob($dir . '/*');
if (!is_array($files)) {
return $fs;
}
foreach ($files as $file) {
if (is_dir($file)) {
$fs = file_list($file, $fs);
} else {
$fs[] = $file;
}
}
return $fs;
}
示例5: file_list
function file_list($path)
{
global $fileList;
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($path . "/" . $file)) {
file_list($path . "/" . $file);
} else {
//echo $path."/".$file."<br>";
$fileList[] = $path . "/" . $file;
}
}
}
}
return $fileList;
}
示例6: file_list
function file_list($src_path, $dst_path)
{
if ($handle = opendir($src_path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && substr($file, 0, 1) != '.') {
if (is_dir($src_path . "/" . $file)) {
$dir = $src_path . "/" . $file;
$GLOBALS['out'] .= '创建目录:' . $dst_path . "/" . $file;
$GLOBALS['out'] .= "<br>\n";
mkdir($dst_path . "/" . $file);
file_list($src_path . "/" . $file, $dst_path . "/" . $file);
} else {
$file_path = $src_path . "/" . $file;
$rs = file_get_contents($file_path);
$GLOBALS['out'] .= '写入文件:' . $dst_path . "/" . $file;
$GLOBALS['out'] .= "<br>\n";
file_put_contents($dst_path . "/{$file}", $rs);
}
}
}
}
}
示例7: imglist_main
function imglist_main()
{
global $print, $x7s, $x7c, $x7p;
$base_image_dir = "/images/";
$image_dir = "/images/";
if (isset($_GET['subdir']) && $_GET['subdir'] != "") {
$image_dir .= $_GET['subdir'] . "/";
}
if ($x7c->permissions['admin_panic'] || authorized($image_dir, $x7p->profile['usergroup'])) {
$basedir = dirname($_SERVER['DOCUMENT_ROOT'] . $_SERVER['PHP_SELF']);
$file_path = $basedir . $image_dir;
$image_root_dir = $basedir . $base_image_dir;
$error = "<p style=\"color: red; font-weight: bold;\">";
if (isset($_GET['file'])) {
$error .= file_upload($file_path);
} elseif (isset($_GET['delete'])) {
$error .= file_delete($file_path . $_GET['delete']);
} elseif (isset($_POST['multidel'])) {
if ($_POST['action'] == 'delete') {
foreach ($_POST['multidel'] as $file) {
$error .= file_delete($file_path . $file);
}
} elseif ($_POST['action'] == 'move') {
foreach ($_POST['multidel'] as $file) {
$error .= file_move($file_path . $file, $image_root_dir . $_POST['dest'] . $file);
}
}
}
$error .= "</p>";
$site_path = dirname($_SERVER['PHP_SELF']) . $image_dir;
$output = file_list($file_path, $site_path);
$body = $error . $output['body'];
$head = $output['head'];
$print->normal_window($head, $body);
} else {
return "Non sei autorizzato a vedere questa pagina <br>";
}
}
示例8: index
public function index($folders = [], $style = '', $url = '', $tips = '')
{
$files = array();
$folders = to_array($folders);
foreach ($folders as $v) {
$_folder = APPPATH . $v;
if (!is_dir($_folder)) {
continue;
}
$_f = file_list($_folder, array(APPPATH . 'static' . DIRECTORY_SEPARATOR . '*'));
foreach ($_f as $_v) {
$files[] = str_replace(APPPATH, '', $_v);
}
}
$styles = ['ball-pulse' => 3, 'ball-grid-pulse' => 9, 'ball-clip-rotate' => 1, 'ball-clip-rotate-pulse' => 2, 'square-spin' => 1, 'ball-clip-rotate-multiple' => 2, 'ball-pulse-rise' => 5, 'ball-rotate' => 1, 'cube-transition' => 2, 'ball-zig-zag' => 2, 'ball-zig-zag-deflect' => 2, 'ball-triangle-path' => 3, 'ball-scale' => 1, 'line-scale' => 5, 'line-scale-party' => 4, 'ball-scale-multiple' => 3, 'ball-pulse-sync' => 3, 'ball-beat' => 3, 'line-scale-pulse-out' => 5, 'line-scale-pulse-out-rapid' => 5, 'ball-scale-ripple' => 1, 'ball-scale-ripple-multiple' => 3, 'ball-spin-fade-loader' => 8, 'line-spin-fade-loader' => 8, 'triangle-skew-spin' => 1, 'pacman' => 5, 'semi-circle-spin' => 1, 'ball-grid-beat' => 9, 'ball-scale-random' => 3];
!array_key_exists($style, $styles) && ($style = 'square-spin');
$this->_files = $files;
$this->_style = $style;
$this->_loading_divs = $styles[$style] ?: 1;
$this->_url = url($url);
$this->_tips = $tips;
return $this->view('tools::system.loading');
}
示例9: file_list
function file_list($dir, $pattern = null, $recurse = false)
{
$result = array();
if (is_dir($dir) && ($handle = opendir($dir))) {
while (($file = readdir($handle)) !== false) {
if (substr($file, 0, 1) != '.' && $file != "Thumbs.db") {
if (is_dir($dir . $file)) {
if ($recurse === true) {
foreach (file_list($dir . $file . '/', $pattern, true) as $f => $sf) {
$result[$f] = $sf;
}
}
} else {
if ($pattern == null || instr($file, $pattern)) {
$result[$dir . $file] = $file;
}
}
}
}
closedir($handle);
}
return $result;
}
示例10: file_list
function file_list($dir)
{
$filter = array(".", "..", "__MACOSX", "nbproject", "_notes", ".DS_Store", ".komodotools", "_tmp", ".git", ".gitignore", ".meta");
//list des nom de fichier ou de dossier a ne pas indexer
$list = scandir($dir);
// on scan le dossier
$r = array_diff($list, $filter);
// on filtre le resultat
$files = [];
foreach ($r as $key => $val) {
//on parcour chaque element
if (is_dir($dir . "/" . $val)) {
unset($r[$key]);
// on supprime le nom du dossier dans la liste de resultat car elle utilisé en clé pour les sous dossiers
$r[$val] = file_list($dir . "/" . $val);
} else {
unset($r[$key]);
// $files[] = $val;
$r["zzz" . $val] = $val;
}
}
ksort($r);
return $r;
}
示例11: file_change_pageby
function file_change_pageby()
{
event_change_pageby('file');
file_list();
}
示例12: pika_init
<?php
require_once 'pika-danio.php';
pika_init();
require_once getcwd() . '-custom/extensions/google_drive_connector/file_list.php';
echo file_list(htmlspecialchars($_GET['folder_id']), htmlspecialchars($_GET['prev_folder_id']), htmlspecialchars($_GET['root_folder_id']));
pika_exit();
示例13: remove_torrent
remove_torrent($infohash);
}
$id = is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"])) ? false : $___mysqli_res;
$mc1->delete_value('MyPeers_' . $CURUSER['id']);
//$mc1->delete_value('lastest_tor_'); //
$mc1->delete_value('last5_tor_');
$mc1->delete_value('scroll_tor_');
sql_query("DELETE FROM files WHERE torrent = " . sqlesc($id));
function file_list($arr, $id)
{
foreach ($arr as $v) {
$new[] = "({$id}," . sqlesc($v[0]) . "," . $v[1] . ")";
}
return join(",", $new);
}
sql_query("INSERT INTO files (torrent, filename, size) VALUES " . file_list($filelist, $id));
//==
$dir = $INSTALLER09['torrent_dir'] . '/' . $id . '.torrent';
if (!bencdec::encode_file($dir, $dict)) {
stderr('Error', 'Could not properly encode file');
}
@unlink($tmpname);
chmod($dir, 0664);
//==
//=== if it was an offer notify the folks who liked it :D
if ($offer > 0) {
$res_offer = sql_query('SELECT user_id FROM offer_votes WHERE vote = \'yes\' AND user_id != ' . sqlesc($CURUSER['id']) . ' AND offer_id = ' . sqlesc($offer)) or sqlerr(__FILE__, __LINE__);
$subject = sqlesc('An offer you voted for has been uploaded!');
$message = sqlesc("Hi, \n An offer you were interested in has been uploaded!!! \n\n Click [url=" . $INSTALLER09['baseurl'] . "/details.php?id=" . $id . "]" . htmlsafechars($torrent, ENT_QUOTES) . "[/url] to see the torrent page!");
while ($arr_offer = mysqli_fetch_assoc($res_offer)) {
sql_query('INSERT INTO messages (sender, receiver, added, msg, subject, saved, location)
示例14: file_list
function file_list($path, $sub_flag, $file_type)
{
global $file_nums_all;
global $file_nums_use;
global $file_use_arr;
system("net use " . $path . " /user:kundyZhang cv0837CVJ ");
$file_type_arr = explode(",", $file_type);
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($path . "\\" . $file)) {
//echo StripSlashes($path)."\\".$file."<br>";//目录名称
if ($sub_flag == "1") {
file_list($path . "\\\\" . $file, "1", $file_type);
}
} else {
//echo StripSlashes($path)."\\".$file."<br>";//文件名称
$file_nums_all++;
$check_file_type = check_file($file);
if (in_array($check_file_type["type"], $file_type_arr)) {
$file_nums_use++;
array_push($file_use_arr, StripSlashes($path) . "\\" . $file);
}
}
}
}
}
}
示例15: file_list
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Website Baker; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once "../../../config.php";
require_once WB_PATH . '/include/captcha/captcha.php';
if (!isset($_SESSION['captcha_time'])) {
exit;
}
//unset($_SESSION['captcha_time']);
// get lists of fonts and backgrounds
require_once WB_PATH . '/framework/functions.php';
$t_fonts = file_list(WB_PATH . '/include/captcha/fonts');
$t_bgs = file_list(WB_PATH . '/include/captcha/backgrounds');
$fonts = array();
$bgs = array();
foreach ($t_fonts as $file) {
if (preg_match('/\\.ttf/', $file)) {
$fonts[] = $file;
}
}
foreach ($t_bgs as $file) {
if (preg_match('/\\.png/', $file)) {
$bgs[] = $file;
}
}
// make random string
if (!function_exists('randomString')) {
function randomString($len)