本文整理汇总了PHP中gpFiles::FTP_CheckDir方法的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles::FTP_CheckDir方法的具体用法?PHP gpFiles::FTP_CheckDir怎么用?PHP gpFiles::FTP_CheckDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpFiles
的用法示例。
在下文中一共展示了gpFiles::FTP_CheckDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckDir
/**
* Check recursively to see if a directory exists, if it doesn't attempt to create it
*
* @param string $dir The directory path
* @param bool $index Whether or not to add an index.hmtl file in the directory
* @return bool True on success
*/
public static function CheckDir($dir, $index = true)
{
global $config;
if (!file_exists($dir)) {
$parent = common::DirName($dir);
gpFiles::CheckDir($parent, $index);
//ftp mkdir
if (isset($config['useftp'])) {
if (!gpFiles::FTP_CheckDir($dir)) {
return false;
}
} else {
if (!@mkdir($dir, gp_chmod_dir)) {
return false;
}
@chmod($dir, gp_chmod_dir);
//some systems need more than just the 0755 in the mkdir() function
}
// make sure there's an index.html file
// only check if we just created the directory, we don't want to keep creating an index.html file if a user deletes it
if ($index && gp_dir_index) {
$indexFile = $dir . '/index.html';
if (!file_exists($indexFile)) {
//not using gpFiles::Save() so we can avoid infinite looping (it's safe since we already know the directory exists and we're not concerned about the content)
file_put_contents($indexFile, '<html></html>');
@chmod($indexFile, gp_chmod_file);
}
}
}
return true;
}
示例2: CheckDir
/**
* Check recursively to see if a directory exists, if it doesn't attempt to create it
*
* @param string $dir The directory path
* @param bool $index Whether or not to add an index.hmtl file in the directory
* @return bool True on success
*/
function CheckDir($dir, $index = true)
{
global $config, $checkFileIndex;
if (!file_exists($dir)) {
$parent = dirname($dir);
gpFiles::CheckDir($parent, $index);
//ftp mkdir
if (isset($config['useftp'])) {
if (!gpFiles::FTP_CheckDir($dir)) {
return false;
}
} else {
if (!@mkdir($dir, gp_chmod_dir)) {
return false;
}
@chmod($dir, gp_chmod_dir);
//some systems need more than just the 0755 in the mkdir() function
}
}
//make sure there's an index.html file
if ($index && $checkFileIndex) {
$indexFile = $dir . '/index.html';
if (!file_exists($indexFile)) {
gpFiles::Save($indexFile, '<html></html>', false);
}
}
return true;
}