granam/tools

工具箱

安装次数: 38,919

依赖项: 12

建议者: 0

安全性: 0

星标: 2

关注者: 2

分支: 0

公开问题: 0

类型:项目

6.1.0 2021-03-24 16:40 UTC

README

use namespace Granam\Tools\ValueDescriber;

// "instance of \stdClass'
echo ValueDescriber::describe(new \stdClass());

// "array {}"
echo ValueDescriber::describe([]);

// "resource"
echo ValueDescriber::describe(tmpfile());

// "123,123.45,'123','123.45',array {\n  0 => string(3) "bar"},instance of \stdClass"
echo ValueDescriber::describe(123, 123.45, '123', '123.45', ['bar'], new \stdClass());

文件上传异常

if ($_FILES['user_attachment1']['error'] === UPLOAD_ERR_OK) {
    // upload successful
} else {
// File of name 'damn_big.png' has not been uploaded (The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form: 2000)
    throw new FileUploadException("File of name '{$_FILES['user_attachment1']['name']}' has not been uploaded", $_FILES['user_attachment1']['error']);
}

安装

composer require granam/tools