本文整理汇总了PHP中Environment::getStorageBasePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::getStorageBasePath方法的具体用法?PHP Environment::getStorageBasePath怎么用?PHP Environment::getStorageBasePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::getStorageBasePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CompanyFactory
//1mb or less
$upload->set_acceptable_types(array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png'));
// comma separated string, or array
//$upload->set_max_image_size(600, 600);
$upload->set_overwrite_mode(1);
$cf = new CompanyFactory();
$cf->cleanStoragePath($current_company->getId());
$dir = $cf->getStoragePath($current_company->getId());
break;
case 'license':
$upload->set_max_filesize(20000);
//1mb or less
$upload->set_acceptable_types(array('text/plain', 'plain/text', 'application/octet-stream'));
// comma separated string, or array
$upload->set_overwrite_mode(1);
$dir = Environment::getStorageBasePath() . DIRECTORY_SEPARATOR . 'license' . DIRECTORY_SEPARATOR . $current_company->getId();
break;
}
Debug::Text('bUpload... Object Type: ' . $object_type, __FILE__, __LINE__, __METHOD__, 10);
if (isset($dir)) {
@mkdir($dir, 0700, TRUE);
$upload_result = $upload->upload("userfile", $dir);
//var_dump($upload ); //file data
if ($upload_result) {
$success = $upload_result . ' ' . TTi18n::gettext('Successfully Uploaded');
} else {
$error = $upload->get_error();
}
}
Debug::Text('cUpload... Object Type: ' . $object_type, __FILE__, __LINE__, __METHOD__, 10);
switch ($object_type) {
示例2: getStoragePath
function getStoragePath($company_id = NULL)
{
if ($company_id == '') {
$company_id = $this->getID();
}
if ($company_id == '') {
return FALSE;
}
return Environment::getStorageBasePath() . DIRECTORY_SEPARATOR . 'company_logo' . DIRECTORY_SEPARATOR . $company_id;
}
示例3: getStoragePath
function getStoragePath($company_id = NULL, $punch_id = NULL)
{
if ($company_id == '' and is_object($this->getPunchControlObject()) and is_object($this->getPunchControlObject()->getUserDateObject()) and is_object($this->getPunchControlObject()->getUserDateObject()->getUserObject())) {
$company_id = $this->getPunchControlObject()->getUserDateObject()->getUserObject()->getCompany();
}
if ($punch_id == '') {
$punch_id = $this->getID();
}
if ($company_id == '') {
return FALSE;
}
if ($punch_id == '') {
return FALSE;
}
$hash = crc32($company_id . $punch_id);
$hash_dir[0] = substr($hash, 0, 2);
$hash_dir[1] = substr($hash, 2, 2);
$hash_dir[2] = substr($hash, 4, 2);
return Environment::getStorageBasePath() . DIRECTORY_SEPARATOR . 'punch_images' . DIRECTORY_SEPARATOR . $company_id . DIRECTORY_SEPARATOR . $hash_dir[0] . DIRECTORY_SEPARATOR . $hash_dir[1] . DIRECTORY_SEPARATOR . $hash_dir[2];
}