本文整理匯總了PHP中FileUtils::saveFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileUtils::saveFile方法的具體用法?PHP FileUtils::saveFile怎麽用?PHP FileUtils::saveFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileUtils
的用法示例。
在下文中一共展示了FileUtils::saveFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _doUpload
private function _doUpload($res, $type)
{
$config = WebUtils::getMobcentConfig('misc');
$path = $config['apnsCertfilePath'];
$certfileAPNs = $path . '/' . $config['apnsCertfileName'];
if ($type == 'add_certfile_apns') {
$password = (string) $_POST['passphrase'];
if (UploadUtils::makeBasePath($path)) {
if (!empty($_FILES) && count($_FILES) && is_uploaded_file($_FILES['file']['tmp_name']) && !$_FILES['file']['error']) {
FileUtils::saveFile($certfileAPNs, file_get_contents($_FILES['file']['tmp_name']));
AppbymeConfig::setAPNsCertfilePassword($password);
} else {
$res = $this->makeErrorInfo($res, WebUtils::t('上傳失敗'));
}
}
} else {
if ($type == 'del_certfile_apns') {
FileUtils::safeDeleteFile($certfileAPNs);
}
}
return $res;
}
示例2: _uploadMobcentImage
private function _uploadMobcentImage($res, $attachment)
{
$savePath = $this->_getSavePath('image');
if (!empty($savePath)) {
$urlFileName = $this->_getPathFileName('image', $attachment['name']);
$fileName = $savePath . '/' . $urlFileName['file'];
if (FileUtils::saveFile($fileName, $attachment['data']) != false) {
// 添加水印
Yii::import('application.components.discuz.source.class.class_image', true);
$image = new Mobcent_Image();
if ($image->param['watermarkstatus']['forum'] > 0) {
$image->makeWatermark($fileName, '', 'forum');
}
$res['urlName'] = $this->_getUrlFileName($urlFileName['path'], basename($fileName));
$res['id'] = 0;
}
}
return $res;
}