国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

在將項目打包為bin文件后,原系統(tǒng)里有個從public目錄里文件獲取不到了

龍正哲

問題描述

各位大佬,在將項目打包為bin文件后,原系統(tǒng)里有個從public目錄里獲取字體文件生成驗證碼的功能,打包成bin后,系統(tǒng)提示無法獲取到文件,且打包配置文件里的 exclude_pattern 也沒有排除 public目錄,請問這個還會是什么情況導(dǎo)致

錯誤內(nèi)容:
getimagesize(phar:\D:\MyProject\admin\build\admin.phar\public\static\fonts\sai.ttf): Failed to open stream: No such file or directory

1200 2 0
2個回答

864328615

解決了嗎大佬,我也遇到了,驗證碼插件的字體文件獲取不到了

864328615
/**
     * @param $font
     * @return string
     */
    protected static function getFontPath($font)
    {
        static $fontPathMap = [];
        if (!\class_exists(\Phar::class, false) || !\Phar::running()) {
            return $font;
        }

        $tmpPath = sys_get_temp_dir() ?: '/tmp';
        $filePath = "$tmpPath/" . basename($font);
        clearstatcache();
        if (!isset($fontPathMap[$font]) || !is_file($filePath)) {
            file_put_contents($filePath, file_get_contents($font));
            $fontPathMap[$font] = $filePath;
        }
        return $fontPathMap[$font];
    }

    $fontttf = self::getFontPath($ttfPath . $config['fontttf']);

我用的那個tinywang的驗證碼插件 應(yīng)該是同理的,解決方法抄的webman作者出的那個驗證碼,目前已解決

  • 龍正哲 2023-08-25

    可以,這個方案可行,其實文件還是獲取的二進制文件外的字體文件了,可以將那個臨時目錄改寫入到 runtime目錄里去,就在當前運行程序下的runtime目錄里了,不會到系統(tǒng)緩存目錄里了