本文整理汇总了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;
}