Yii2.X 如何避开pathinfo不能处理中文名开头的bug

    /**
     * @return string original file base name
     */
    public function getBaseName()
    {
        // https://github.com/yiisoft/yii2/issues/11012
        return mb_substr(pathinfo('_' . $this->name, PATHINFO_FILENAME), 1, null, '8bit');
    }

    /**
     * @return string file extension
     */
    public function getExtension()
    {
        return strtolower(pathinfo($this->name, PATHINFO_EXTENSION));
    }

 

posted on 2017-06-02 17:38  周~~  阅读(465)  评论(0编辑  收藏  举报

导航