本文整理汇总了PHP中gpFiles::FTPConnect方法的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles::FTPConnect方法的具体用法?PHP gpFiles::FTPConnect怎么用?PHP gpFiles::FTPConnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpFiles
的用法示例。
在下文中一共展示了gpFiles::FTPConnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FTP_CheckDir
public static function FTP_CheckDir($dir)
{
$conn_id = gpFiles::FTPConnect();
$dir = gpFiles::ftpLocation($dir);
if (!ftp_mkdir($conn_id, $dir)) {
return false;
}
return ftp_site($conn_id, 'CHMOD 0777 ' . $dir);
}
示例2: MakeDir
function MakeDir($parent, $new_name)
{
global $config, $langmessage;
$langmessage['not_created'] = 'Oops, the folder could not be created. ';
$langmessage['not_created'] .= 'You may still be able to create it by doing one of the following: ';
$langmessage['not_created'] .= '<ul>';
$langmessage['not_created'] .= '<li>Make the parent folder writable by changing it\'s permissions.</li>';
$langmessage['not_created'] .= '<li>Supply your server\'s <a href="%s">ftp information</a> to this plugin.</li>';
$langmessage['not_created'] .= '</ul>';
$langmessage['not_created'] = sprintf($langmessage['not_created'], common::GetUrl('Admin_Site_Setup', 'cmd=settings'));
$new_folder = $parent . '/' . $new_name;
if (mkdir($new_folder, 0755)) {
chmod($new_folder, 0755);
//some systems need more than just the 0755 in the mkdir() function
return true;
}
if (empty($config['ftp_server'])) {
message($langmessage['not_created']);
return false;
}
$conn_id = gpFiles::FTPConnect();
if (!$conn_id) {
message($langmessage['not_created'] . ' (FTP Connection Failed)');
return false;
}
$ftp_parent = gpftp::GetFTPRoot($conn_id, $parent);
if (!$ftp_parent) {
message('Oops, could not find the ftp location of <i>' . $parent . '</i> using the current ftp login.');
return false;
}
$ftp_destination = $ftp_parent . '/' . $new_name;
if (!ftp_mkdir($conn_id, $ftp_destination)) {
message('Oops, could not create the folder using the current ftp login.');
return false;
}
ftp_site($conn_id, 'CHMOD 0755 ' . $ftp_destination);
return true;
}