phpzm/phpee

具有相同处理程序的库,使PHP更容易使用

1.0.7 2019-07-01 03:15 UTC

This package is auto-updated.

Last update: 2024-08-29 04:48:26 UTC


README

这是一个旨在通过创建对PHP资源包装器来平衡API使用体验的项目,同时提供几乎所有项目都需要的功能助手。

例如,我们可以使用Php\File::write()代替file_put_contents()

扩展的别名

Base64

编码

文件

  • int write(string $filename, mixed $data, int $flags = 0, resource $context = null)

    别名: https://php.ac.cn/file_put_contents
    例子:Php\File::write(string, mixed, int, resource);
  • string read(string $filename, bool $use_include_path = false, resource $context = null, int $offset = 0, int $maxlen = null)

    别名: https://php.ac.cn/file_get_contents
    例子:Php\File::read(string, boolean, resource, int, int);
  • bool exists(string $filename)

    别名: https://php.ac.cn/file_exists
    例子:Php\File::exists(string);

哈希

  • string md5(string $string, bool $raw = false)

    别名: https://php.ac.cn/md5
    例子:Php\Hash::md5(string, bool);
  • string sha1(string $string, bool $raw = false)

    别名: https://php.ac.cn/sha1
    例子:Php\Hash::sha1(string, bool);

JSON

  • string encode(mixed $value, int $options = 0, int $depth = 512)

    别名: https://php.ac.cn/json_encode
    示例: Php\JSON::encode(string, int, int);
  • string decode(string $json, bool $assoc = false, int $depth = 512, int $options = 0)

    别名: https://php.ac.cn/json_decode
    示例: Php\JSON::decode(string, bool, int, int);

正则表达式

  • string split($pattern, string $subject, int $limit = -1, int $flags = 0)

    别名: https://php.ac.cn/preg_split
    示例: Php\Regex::split(string, string, int, int);

文本

附加资源

Http

  • mixed post(string $index)

    获取 $_POST 的值
    示例:Php\Http::post(字符串)

  • mixed get(string $index)

    获取 $_GET 的值
    示例:Php\Http::post(字符串)

  • mixed file(string $index)

    获取 $_FILES 的值
    示例:Php\Http::post(字符串)

  • mixed all($index = null)

    获取 $_REQUEST 的值
    示例:Php\Http::all(字符串)

Url

  • string host()

    获取应用程序的主机名
    示例:Php\Url::host()

  • string current()

    获取当前应用程序请求的 URL
    示例:Php\Url::current()