本文整理汇总了PHP中filetype函数的典型用法代码示例。如果您正苦于以下问题:PHP filetype函数的具体用法?PHP filetype怎么用?PHP filetype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filetype函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setPath
/**
* @param string $path
* @throws \Exception
*/
public function setPath($path)
{
if (!(filter_var($path, FILTER_VALIDATE_IP) || filter_var($path, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) && (!file_exists($path) || filetype($path) !== 'socket')) {
throw new \Exception('Ruta o archivo no válido');
}
$this->path = $path;
}
开发者ID:nuxsmin,项目名称:sysMonDash,代码行数:11,代码来源:ConfigBackendLivestatus.class.php
示例2: files_identical
public static function files_identical($fn1, $fn2, array $exclude = [])
{
if (filetype($fn1) !== filetype($fn2)) {
return FALSE;
}
/* if (filesize($fn1) !== filesize($fn2))
return FALSE; */
if (!($fp1 = @fopen($fn1, 'r'))) {
return FALSE;
}
if (!($fp2 = @fopen($fn2, 'r'))) {
fclose($fp1);
return FALSE;
}
$same = TRUE;
$count = 1;
while (($bufer1 = fgets($fp1, 4096)) !== false && ($bufer2 = fgets($fp2, 4096)) !== false) {
if (!in_array($count, $exclude)) {
if ($bufer1 !== $bufer2) {
$same = FALSE;
break;
}
}
$count++;
}
fclose($fp1);
fclose($fp2);
return $same;
}
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:29,代码来源:file_helper.php
示例3: transfer_templates
function transfer_templates($dir, $root_dir, $level = 0)
{
if (!$dh = @opendir($dir))
die("ERROR! Unable to open directory " . $dir . ".\n");
while ($file = readdir($dh)) {
if ($file == "." || $file == "..")
continue;
$full_path = $dir . "/" . $file;
$filetype = filetype($full_path);
if ($filetype == "dir") {
transfer_templates($full_path, $root_dir, $level + 1);
continue;
}
if ($filetype != "file") // ignore special files and links
continue;
$ending = substr($file, strlen($file) - 4);
if ($ending != ".tpl") // ignore files that are not templates (end in .tpl)
continue;
$rel_path = substr($full_path, strlen($root_dir) + 1);
$sql = "INSERT IGNORE INTO Templates (Name, Level) values('"
. $rel_path . "', " . $level . ")";
if (!mysql_query($sql))
die("Unable to insert template " . $rel_path . ".\n");
}
}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:28,代码来源:transfer_templates.php
示例4: dircrawl
function dircrawl($dir, $hash_array, $extension_exclusions)
{
$dir = rtrim($dir, "\\/");
$return = "";
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file != "." and $file != "..") {
if (filetype($dir . "\\" . $file) == "dir") {
$return .= dircrawl($dir . "\\" . $file, $hash_array, $extension_exclusions);
} else {
if (filetype($dir . "\\" . $file) == "file") {
if (!in_array(pathinfo($dir . "\\" . $file, PATHINFO_EXTENSION), $extension_exclusions)) {
$hash_output = "";
foreach ($hash_array as $hash_type) {
$hash_output .= ",\"" . hash_file($hash_type, $dir . "\\" . $file) . "\"";
}
$return .= "\"" . dirname($dir . "\\" . $file) . "\",\"" . basename($dir . "\\" . $file) . "\",\"" . filesize($dir . "\\" . $file) . "\"" . $hash_output . "\n";
}
}
}
}
}
}
return $return;
}
开发者ID:JhunCabas,项目名称:avarice-nms,代码行数:25,代码来源:hasher.php
示例5: drawAdminTools_Tools
function drawAdminTools_Tools($domain)
{
global $adm_login;
global $adm_pass;
global $addrlink;
global $lang;
global $htaccess_edit_flag_selected_subdomain;
$out = "";
$out .= subdomainSelector($domain);
if ($htaccess_edit_flag_selected_subdomain == "yes") {
if (isset($_REQUEST["edit_folder"]) && $_REQUEST["edit_folder"] == "/") {
$link1 = "";
$link2 = "";
} else {
$link1 = "<a href=\"" . $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}&addrlink={$addrlink}&edit_subdomain=" . $domain["subdomains"][$i]["name"] . "&edit_folder=/\">";
$link2 = "</a>";
}
$out .= "{$link1} / {$link2}";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$out .= "fichier : {$file} : type : " . filetype($dir . $file);
}
closedir($dh);
}
}
}
return $out;
}
开发者ID:jeremy-cayrasso,项目名称:dtc,代码行数:29,代码来源:tools.php
示例6: fetch_data
function fetch_data()
{
global $msg;
global $PMBuserid;
$this->error = "";
$this->info = array();
$i = 0;
if (!is_dir($this->path)) {
$this->error = $msg["admin_files_gestion_error_is_no_path"] . $this->path;
$this->path = "";
return;
}
if (($objects = @scandir($this->path)) !== false) {
foreach ($objects as $object) {
if ($object != '.' && $object != '..') {
if (filetype($this->path . "/" . $object) != "dir") {
$this->info[$i]['name'] = $object;
$this->info[$i]['path'] = $this->path;
$this->info[$i]['type'] = filetype($this->path . $object);
$i++;
}
}
}
}
}
开发者ID:hogsim,项目名称:PMB,代码行数:25,代码来源:files_gestion.class.php
示例7: loadRanksets
function loadRanksets()
{
global $ranksetData, $ranksetNames;
if (isset($ranksetNames)) {
return;
}
$ranksetData = array();
$ranksetNames = array();
$dir = "ranksets/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (filetype($dir . $file) != "dir") {
continue;
}
if ($file == ".." || $file == ".") {
continue;
}
$infofile = $dir . $file . "/rankset.php";
if (file_exists($infofile)) {
include $infofile;
}
}
closedir($dh);
}
}
}
开发者ID:knytrune,项目名称:ABXD,代码行数:27,代码来源:ranksets.php
示例8: DealFP
/**
* 遍历指定的目录以及子目录,将符合条件的文件加入XML
* $p 指定的目录
*/
function DealFP($p){
$FilterDir = $GLOBALS["FilterDir"];
$IndexFileExt = $GLOBALS["IndexFileExt"];
$handle=opendir($p);
if ($p==".") $path = "";
else $path = $p."/";
while ($file = readdir($handle))
{
$d = filetype($path.$file);
if ((($d=='file')||($d=='dir'))&&($file!='.')&&($file!='..'))
{
$pf = $path.$file;
//echo "[".$d."]".$pf."<br>";
if ($d=='dir')
{
if (!(strpos($FilterDir, "|".$pf."|")))
{
DealFP($pf);
}
}else{
$ext = "|".strtolower(substr($file, strrpos($file, ".")+1))."|";
if (strpos($IndexFileExt, $ext))
{
$d = filemtime($pf);
$dt = date("Y-m-d",$d)."T".date("H:i:s",$d)."+00:00";
addToXML($pf, $dt);
}
}
}
}
closedir($handle);
}
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:38,代码来源:sitemap.php
示例9: getFiles
function getFiles($path, $filter = '*', $recursive = false)
{
//Ajusta os filtros
$filter = strtolower($filter);
//Ajusta o nome da pasta
if (substr($path, -1, 1) != '/') {
$path .= '/';
}
//Se o caminho informado nao for um diretorio, pula fora
if (!is_dir($path)) {
return array();
}
$files = array();
$dir = opendir($path);
while (($file = readdir($dir)) !== false) {
if ($file != '.' && $file != '..' && strtolower($file) != '.ds_store') {
//Se for um diretorio e estiver ativo a recursividade
if (is_dir($path . $file) && $recursive) {
//Busca os arquivos de dentro do diretorio
$files[] = array('file' => $file, 'path' => $path, 'full' => $path . $file . '/', 'type' => filetype($path . $file), 'ext' => '');
$files = array_merge($files, $this->getFiles($path . $file, $filter, true));
} else {
//Adiciona um arquivo na lista
$ext = explode('.', $file);
$ext = strtolower(end($ext));
if ($filter == '*' || strpos('|' . $filter, $ext)) {
$files[] = array('file' => utf8_encode($file), 'name' => substr($file, 0, strlen($file) - 1 - strlen($ext)), 'path' => utf8_encode($path), 'full' => utf8_encode($path . $file), 'type' => filetype($path . $file), 'ext' => $ext);
}
}
}
}
return $files;
}
开发者ID:soares289,项目名称:gojira,代码行数:33,代码来源:fs.class.php
示例10: getFileList
/**
* @param $dir
*
* @return array
*/
private function getFileList($dir)
{
// array to hold return value
$retval = array();
// add trailing slash if missing
if (substr($dir, -1) != '/') {
$dir .= '/';
}
// open pointer to directory and read list of files
$d = @dir($dir) or die("getFileList: Failed opening directory {$dir} for reading");
while (false !== ($entry = $d->read())) {
$info = pathinfo($entry);
$ext = $info['extension'];
// skip hidden files
if ($entry[0] == '.') {
continue;
}
if (is_dir("{$dir}{$entry}")) {
$retval[] = array('name' => "{$entry}", 'fullpath' => "{$dir}/{$entry}", 'type' => filetype("{$dir}{$entry}"), 'size' => 0, 'lastmod' => filemtime("{$dir}{$entry}"), 'ext' => $ext);
} elseif (is_readable("{$dir}{$entry}")) {
$retval[] = array('name' => "{$entry}", 'fullpath' => "{$dir}/{$entry}", 'type' => mime_content_type("{$dir}{$entry}"), 'size' => filesize("{$dir}{$entry}"), 'lastmod' => filemtime("{$dir}{$entry}"), 'ext' => $ext);
}
}
$d->close();
return $this->aasort($retval, 'name');
}
开发者ID:openeyes,项目名称:openeyes,代码行数:31,代码来源:TestHarnessController.php
示例11: mailPdf
function mailPdf($from, $to, $subject, $files)
{
$_boundary = md5(uniqid(microtime(), TRUE));
$_headers = 'From: ' . $from . "\r\n";
$_headers .= 'Mime-Version: 1.0' . "\r\n" . 'Content-type: multipart/mixed; boundary=' . $_boundary . "\r\n";
$_to = $to;
$_subject = $subject;
//message html
$_message = '--' . $_boundary . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
$_message .= 'Voici le rapport de supervision de la semaine dernière.';
$_message .= "\r\n";
foreach ($files as $key => $file) {
if (file_exists($file["url"])) {
$_fileType = filetype($file["url"]);
$_fileContent = file_get_contents($file["url"]);
if (!$_fileContent) {
die('Impossible de lire le fichier ' . $file["url"]);
}
$_fileContent = chunk_split(base64_encode($_fileContent));
$_message .= '--' . $_boundary . "\r\n" . 'Content-type: application/pdf' . '; name=' . $key . "\r\n" . 'Content-transfer-encoding: base64' . "\r\n";
$_message .= $_fileContent . "\r\n";
}
$_message .= '--' . $_boundary . "\r\n";
}
mail($_to, $_subject, $_message, $_headers);
}
开发者ID:hagen3000,项目名称:centreon-pdf-reports,代码行数:26,代码来源:Mail-Func.php
示例12: copy_directory
function copy_directory($directory, $destination)
{
$destination = $destination . basename($directory);
# The directory will be created
if (!file_exists($destination)) {
if (!mkdir($destination)) {
return false;
}
}
$directory_list = @scandir($directory);
# Directory scanning
if (!$directory_list) {
return false;
}
foreach ($directory_list as $item_name) {
$item = $directory . DIRECTORY_SEPARATOR . $item_name;
if ($item_name == '.' || $item_name == '..') {
continue;
}
if (filetype($item) == 'dir') {
copy_directory($item, $destination . DIRECTORY_SEPARATOR);
} else {
var_dump($item);
var_dump($destination . DIRECTORY_SEPARATOR . $item_name);
if (!copy($item, $destination . DIRECTORY_SEPARATOR . $item_name)) {
return false;
}
}
}
return true;
}
开发者ID:bilgisayarcilik,项目名称:Remote-File-Manager,代码行数:31,代码来源:other_actions.php
示例13: __construct
public function __construct($cache_path = '', $plugin_dir = '')
{
if ($cache_path) {
$this->cache_path = $cache_path;
} else {
$this->cache_path = CACHE_PATH;
}
if ($plugin_dir) {
$this->plugin_dir = $plugin_dir;
} else {
$this->plugin_dir = PLUGIN_PATH . 'lezaz/plugin/';
}
// include all plugin
if ($dh = opendir($this->plugin_dir)) {
while (($file = readdir($dh)) !== false) {
$ext = explode('.', $file);
if ($file != '.' && $file != '..' && filetype($this->plugin_dir . $file) != 'dir' && $ext[1] == 'php') {
$this->element[] = $ext[0];
include $this->plugin_dir . $file;
}
}
closedir($dh);
}
$this->translate['all'] = array('{{lng}}', '{{lnguage}}', '{{ltr}}');
$this->translate['ar'] = array('ar', 'arabic', 'rtl');
$this->translate['en'] = array('en', 'english', 'ltr');
}
开发者ID:sfhati,项目名称:lezaz,代码行数:27,代码来源:__lezaz.php
示例14: get_ftpdir
/**
* getftpdir - ftp konyvtar beolvasasa
*
* @param string az ftp konyvtar eleresi utja
* @param string a vizsgalt file-ok tipusa (picture vagy video lehet)
* @access public
* @return string
*/
function get_ftpdir($ftpdir, $type)
{
$ret = array();
if (!is_dir($ftpdir)) {
return $ret;
}
if (($dir = opendir($ftpdir)) === FALSE) {
return $ret;
}
$i = 0;
while (($file = readdir($dir)) !== FALSE) {
if ($type == "picture") {
if (preg_match("/\\.(jpe?g|gif|png)\$/i", $file) && filetype($ftpdir . $file) == 'file') {
$ret[$i] = $file;
$i++;
}
}
if ($type == "video") {
if (preg_match("/\\.(mpe?g|avi|wmv)\$/i", $file) && filetype($ftpdir . $file) == 'file') {
$ret[$i] = $file;
$i++;
}
}
}
closedir($dir);
return $ret;
}
开发者ID:span20,项目名称:Kallay,代码行数:35,代码来源:function.gallery.php
示例15: stat
function stat($file, $md5 = true, $sha1 = true)
{
$rval = array();
foreach (stat($file) as $i => $v) {
if (is_numeric($i)) {
continue;
}
$rval[$i] = $v;
}
$rval['type'] = filetype($file);
if ($rval['type'] == 'file') {
if ($md5) {
$rval['md5'] = md5_file($file);
}
if ($sha1) {
$rval['sha1'] = sha1_file($file);
}
}
$dir = $this->dir;
if (0 !== strpos($file, $dir) && 'wp-config.php' == basename($file)) {
$dir = explode(DIRECTORY_SEPARATOR, $dir);
array_pop($dir);
$dir = implode(DIRECTORY_SEPARATOR, $dir);
}
$rval['path'] = str_replace($dir, '', $file);
return $rval;
}
开发者ID:roblarsen,项目名称:jquery-wp-content,代码行数:27,代码来源:class.vaultpress-filesystem.php
示例16: findFiles
function findFiles($dir)
{
$dir = trim($dir);
if (substr($dir, -1) != '/') {
$dir .= "/";
}
$files = array();
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file == "." || $file == "..") {
continue;
}
switch (filetype($dir . $file)) {
case "file":
if (substr($file, -4) == ".php") {
$files[] = $dir . $file;
}
break;
case "dir":
$files = array_merge($files, findFiles($dir . $file));
break;
}
}
closedir($dh);
}
}
return $files;
}
开发者ID:arif4562,项目名称:GAE-IP-TO-COUNTRY,代码行数:29,代码来源:parser.php
示例17: delete_subdirectories
function delete_subdirectories($rootdir)
{
$dir = opendir($rootdir);
while (false !== ($file = readdir($dir))) {
if ($file != '.' and $file != '..') {
$fullfile = $rootdir . '/' . $file;
if (filetype($fullfile) == 'dir') {
delete_subdirectories($fullfile);
echo 'Deleting ' . $fullfile . ' ... ';
if (rmdir($fullfile)) {
echo 'Done.<br />';
} else {
echo 'FAILED.<br />';
}
} else {
echo 'Deleting ' . $fullfile . ' ... ';
if (unlink($fullfile)) {
echo 'Done.<br />';
} else {
echo 'FAILED.<br />';
}
}
}
}
closedir($dir);
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:26,代码来源:delete.php
示例18: getDirFiles
function getDirFiles($dir = './', $fileExt = '')
{
$aRtn = array();
$pos = strrchr($dir, DIRECTORY_SEPARATOR);
if ($pos === false) {
$dir .= DIRECTORY_SEPARATOR;
}
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dirHandle = opendir($dir)) {
while (($file = readdir($dirHandle)) !== false) {
if (filetype($dir . $file) != 'dir') {
if ($fileExt) {
if ($fileExt == gfe($file)) {
array_push($aRtn, $file);
}
continue;
}
array_push($aRtn, $file);
}
}
closedir($dirHandle);
}
}
return $aRtn;
}
开发者ID:scirelli,项目名称:garminparser,代码行数:26,代码来源:getDirFiles.php
示例19: list_dir
function list_dir($path, $level = 1)
{
if ($d = dir($path)) {
if (preg_match('/^(.*)\\/$/', $path)) {
// удаляем / на конце, если есть
$path = substr($path, 0, -1);
}
while (false !== ($entry = $d->read())) {
if ($entry != '.' and $entry != '..') {
if (is_dir("{$path}/{$entry}")) {
echo sprintf("%{$level}s", ' ') . "[{$path}/{$entry}]\n";
list_dir("{$path}/{$entry}", $level + 1);
} else {
$level1 = 50 - $level;
echo sprintf("%{$level}s", ' ') . sprintf("%-{$level1}s", $entry);
echo sprintf("%10s", filesize("{$path}/{$entry}")) . "\t" . filetype("{$path}/{$entry}");
echo "\t" . fileowner("{$path}/{$entry}") . "\n";
}
}
}
// if
$d->close();
}
// if
}
开发者ID:pombredanne,项目名称:lishnih,代码行数:25,代码来源:func_other.php
示例20: deleteScssDir
function deleteScssDir($catName)
{
$catName = '../../scss/' . $catName;
if (is_dir($catName)) {
$objects = scandir($catName);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($catName . "/" . $object) == "dir") {
deleteCompDir($catName . "/" . $object);
} else {
unlink($catName . "/" . $object);
}
}
}
reset($objects);
rmdir($catName);
}
/*if (is_dir('../../scss/'.$catName)) {
$objects = scandir('../../scss/'.$catName);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($catName."/".$object) == "dir") deleteScssDir('../../scss/'.$catName."/".$object); else unlink('../../scss/'.$catName."/".$object);
}
}
reset($objects);
rmdir('../../scss/'.$catName);
} */
}
开发者ID:nickberens360,项目名称:atomic-site,代码行数:28,代码来源:cat-delete-functions.php
注:本文中的filetype函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论