本文整理汇总了PHP中CoreUtils::length方法的典型用法代码示例。如果您正苦于以下问题:PHP CoreUtils::length方法的具体用法?PHP CoreUtils::length怎么用?PHP CoreUtils::length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoreUtils
的用法示例。
在下文中一共展示了CoreUtils::length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkStringLength
static function checkStringLength($value, $range, &$code)
{
return $code = self::_numberInRange(CoreUtils::length($value), $range);
}
示例2: __construct
/**
* Construct an instance of the class
*
* @param string $pattern
* @param string $modifiers
* @param string $delimiter
*
* @return RegExp
*/
public function __construct(string $pattern, string $modifiers = '', string $delimiter = '~')
{
$this->_delimiter = $delimiter[0] ?? '~';
$this->_pattern = $pattern;
$this->_modifiers = CoreUtils::length($modifiers) ? $modifiers : '';
}
示例3: processUploadedImage
/**
* Function to process uploaded images
*
* Checks the $_FILES array for an item named $key,
* checks if file is an image, and it's mime type
* can be found in $allowedMimeTypes, and finally
* checks if the size is at least $minwidth by $minheight,
* then moves it to the requested $path.
*
* @param string $key
* @param string $path
* @param array|null $allowedMimeTypes
* @param int $minwidth
* @param int|null $minheight
*
* @return null
*/
static function processUploadedImage($key, $path, $allowedMimeTypes, $minwidth, $minheight = null)
{
if (!isset($minheight)) {
$minheight = $minwidth;
}
if (!isset($_FILES[$key])) {
return self::grabImage($path, $allowedMimeTypes, $minwidth, $minheight);
}
$file = $_FILES[$key];
$tmp = $file['tmp_name'];
if (CoreUtils::length($tmp) < 1) {
Response::fail('File upload failed; Reason unknown');
}
list($width, $height) = Image::checkType($tmp, $allowedMimeTypes);
CoreUtils::createUploadFolder($path);
if (!move_uploaded_file($tmp, $path)) {
@unlink($tmp);
Response::fail('File upload failed; Writing image file was unsuccessful');
}
Image::checkSize($path, $width, $height, $minwidth, $minheight);
}