在 Laravel 5.4 中报错:Call to undefined function App//App//Services//exif_read_data()

1、在 Laravel 5.4 中报错:Call to undefined function App//App//Services//exif_read_data()。如图1

在 Laravel 5.4 中报错:Call to undefined function App//App//Services//exif_read_data()。

图1

{
  "code": 10000,
  "message": "Call to undefined function App//App//Services//exif_read_data()",
  "trace": [
    {
      "file": "E://wwwroot//msi_main//app//App//Services//StorageService.php",
      "line": 66,
      "function": "image_fix_orientation",
      "class": "App//App//Services//StorageService",
      "type": "->",
      "args": [
        "E://phpuploadtmp//php8753.tmp"
      ]
    },
    {
      "file": "E://wwwroot//msi_main//app//Http//Controllers//Web//Prize//PrizeController.php",
      "line": 458,
      "function": "storeAsTmpImage",
      "class": "App//App//Services//StorageService",
      "type": "->",
      "args": [
        {},
        {
          "ext": "jpg"
        }
      ]
    },
    {
      "function": "upload",
      "class": "App//Http//Controllers//Web//Prize//PrizeController",
      "type": "->",
      "args": [
        {
          "attributes": {},
          "request": {},
          "query": {},
          "server": {},
          "files": {},
          "cookies": {},
          "headers": {}
        },
        {}
      ]
    },
    {
      "file": "E://wwwroot//msi_main//vendor//laravel//framework//src//Illuminate//Routing//Controller.php",
      "line": 55,
      "function": "call_user_func_array",
      "args": [
        [
          {},
          "upload"
        ],
        [
          {
            "attributes": {},
            "request": {},
            "query": {},
            "server": {},
            "files": {},
            "cookies": {},
            "headers": {}
          },
          {}
        ]
      ]
    },
    {
      "file": "E://wwwroot//msi_main//vendor//laravel//framework//src//Illuminate//Routing//ControllerDispatcher.php",
      "line": 44,
      "function": "callAction",
      "class": "Illuminate//Routing//Controller",
      "type": "->",
      "args": [
        "upload",
        [
          {
            "attributes": {},
            "request": {},
            "query": {},
            "server": {},
            "files": {},
            "cookies": {},
            "headers": {}
          },
          {}
        ]
      ]
    },
    {
      "file": "E://wwwroot//msi_main//vendor//laravel//framework//src//Illuminate//Routing//Route.php",
      "line": 203,
      "function": "dispatch",
      "class": "Illuminate//Routing//ControllerDispatcher",
      "type": "->",
      "args": [
        {
          "uri": "web/prize/upload",
          "methods": [
            "POST"
          ],
          "action": {
            "middleware": "web",
            "uses": "App//Http//Controllers//Web//Prize//PrizeController@upload",
            "controller": "App//Http//Controllers//Web//Prize//PrizeController@upload",
            "namespace": "App//Http//Controllers",
            "prefix": null,
            "where": []
          },
          "controller": {},
          "defaults": [],
          "wheres": [],
          "parameters": [],
          "parameterNames": [],
          "computedMiddleware": [
            "web"
          ],
          "compiled": {}
        },
        {},
        "upload"
      ]
    },
    {
      "file": "E://wwwroot//msi_main//vendor//laravel//framework//src//Illuminate//Routing//Route.php",
      "line": 160,
      "function": "runController",
      "class": "Illuminate//Routing//Route",
      "type": "->",
      "args": []
    },
    {
      "file": "E://wwwroot//msi_main//vendor//laravel//framework//src//Illuminate//Routing//Router.php",
      "line": 572,
      "function": "run",
      "class": "Illuminate//Routing//Route",
      "type": "->",
      "args": []
    },
    {
      "file": "E://wwwroot//msi_main//vendor//laravel//framework//src//Illuminate//Routing//Pipeline.php",
      "line": 30,
      "function": "Illuminate//Routing//{closure}",
      "class": "Illuminate//Routing//Router",
      "type": "->",
      "args": [
        {
          "attributes": {},
          "request": {},
          "query": {},
          "server": {},
          "files": {},
          "cookies": {},
          "headers": {}
        }
      ]
    },
    {
      "file": "E://wwwroot//msi_main//app//Http//Middleware//ConsoleCMCAuthenticate.php",
      "line": 73,
      "function": "Illuminate//Routing//{closure}",
      "class": "Illuminate//Routing//Pipeline",
      "type": "->",
      "args": [
        {
          "attributes": {},
          "request": {},
          "query": {},
          "server": {},
          "files": {},
          "cookies": {},
          "headers": {}
        }
      ]
    }
  ]
}

2、exif_read_data — 从一个图片文件中读取 EXIF 头信息。是一个 Exif 函数,依赖于扩展:Exif。查看 phpinfo 。未安装扩展:Exif。如图2

exif_read_data — 从一个图片文件中读取 EXIF 头信息。是一个 Exif 函数,依赖于扩展:Exif。查看 phpinfo 。未安装扩展:Exif。

图2

3、本地环境为 Windows 10,查看扩展目录:C:/php-7.4.6/ext,文件 php_exif.dll 存在。如图3

本地环境为 Windows 10,查看扩展目录:C:/php-7.4.6/ext,文件 php_exif.dll 存在。

图3

4、编辑文件 php.ini。取消 ;extension=exif 中的 ;。
修改前:

;extension=exif      ; Must be after mbstring as it depends on it

修改后:

extension=exif      ; Must be after mbstring as it depends on it

5、查看 phpinfo 。已安装扩展:Exif。如图4

查看 phpinfo 。已安装扩展:Exif。

图4

6、再次上传图片,未再报错。如图5

再次上传图片,未再报错。

图5

原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/181702.html

(0)
上一篇 2021年11月1日
下一篇 2021年11月1日

相关推荐

发表回复

登录后才能评论