本文整理匯總了PHP中files::copyRemote方法的典型用法代碼示例。如果您正苦於以下問題:PHP files::copyRemote方法的具體用法?PHP files::copyRemote怎麽用?PHP files::copyRemote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類files
的用法示例。
在下文中一共展示了files::copyRemote方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: install
function install($url)
{
$dest = $this->location . '/' . basename($url);
if (!file_exists($dest) && ($err = files::copyRemote($url, $dest) !== true)) {
return $err;
} else {
if (($content = @implode('', @gzfile($dest))) === false) {
return __('Cannot open file');
} else {
if (($list = unserialize($content)) === false) {
return __('Plugin not valid');
} else {
if (is_dir($this->location . '/' . $list['name'])) {
/*if (files::deltree($this->location.'/'.$list['name']) === false)
{
return 'Impossible de supprimer le plugin existant';
}*/
unlink($dest);
return __('This plugin still exists. Delete it before.');
}
foreach ($list['dirs'] as $d) {
mkdir($this->location . '/' . $d, fileperms($this->location));
chmod($this->location . '/' . $d, fileperms($this->location));
}
foreach ($list['files'] as $f => $v) {
$v = base64_decode($v);
$fp = fopen($this->location . '/' . $f, 'w');
fwrite($fp, $v, strlen($v));
fclose($fp);
chmod($this->location . '/' . $f, fileperms($this->location) & ~0111);
}
unlink($dest);
}
}
}
return true;
}