本文整理汇总了PHP中lang::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP lang::assign方法的具体用法?PHP lang::assign怎么用?PHP lang::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lang
的用法示例。
在下文中一共展示了lang::assign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lang
/**
* Gets the correct error message.
*
* Methoed tries to use $lang-Object. If not available, hardcoded english phrases will be used.
*
* @return string error message
*/
function get_error()
{
if ($this->error == null) {
return false;
}
$lang = new lang();
$lang->group("classes");
switch ($this->error) {
case UPLOAD_ERR_FILE_INDEX:
$message = $lang->phrase('upload_error_noupload');
break;
case UPLOAD_ERR_FILE_SIZE:
$lang->assign('mfs', formatFilesize($this->max_filesize));
$message = $lang->phrase('upload_error_maxfilesize');
break;
case UPLOAD_ERR_IMAGE_WIDTH:
case UPLOAD_ERR_IMAGE_HEIGHT:
$lang->assign('mih', $this->max_image_height > 0 ? numbers($this->max_image_height) : $lang->phrase('upload_unspecified'));
$lang->assign('miw', $this->max_image_width > 0 ? numbers($this->max_image_width) : $lang->phrase('upload_unspecified'));
$message = $lang->phrase('upload_error_maximagesize');
break;
case UPLOAD_ERR_FILE_TYPE:
$lang->assign('aft', implode(', ', $this->file_types));
$message = $lang->phrase('upload_error_wrongfiletype');
break;
case UPLOAD_ERR_COPY:
$message = $lang->phrase('upload_error_noaccess');
break;
case UPLOAD_ERR_FILE_EXISTS:
$message = $lang->phrase('upload_error_fileexists');
break;
default:
$message = $lang->phrase('upload_error_default');
}
if (!empty($this->file['name'])) {
return "{$this->file['name']}: {$message}";
} else {
return $message;
}
}