Skip to content

data_get的key麻烦强制转换下为字符串,比如__toString()这样的特性就可以用到了 #1

Description

@aogg
/**
 * Get an item from an array or object using "dot" notation.
 *
 * @param mixed $target
 * @param null|array|int|string $key
 * @param mixed $default
 * @return mixed
 */
function data_get($target, $key, $default = null)
{
    if (is_null($key)) {
        return $target;
    }

    $key = is_array($key) ? $key : explode('.', strval($key));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions