【问题标题】:Call to undefined function mime_content_type()调用未定义函数 mime_content_type()
【发布时间】:2018-01-31 12:48:31
【问题描述】:

使用套件 crm 7.9.1 。 suitecrm 的新手。

我在 Campaigns 模块中创建了一个人员表单。创建成功。但是当我尝试下载它时,出现以下错误。

致命错误:未捕获错误:调用未定义函数 /home/testsite/public_html/download.php:180 中的 mime_content_type() 堆栈跟踪:#0 /home/testsite/public_html/include/MVC/Controller/SugarController.php(1007): 要求一次()#1 /home/testsite/public_html/include/MVC/Controller/SugarController.php(458): SugarController->handleEntryPoint() #2 /home/testsite/public_html/include/MVC/Controller/SugarController.php(366): SugarController->process() #3 /home/testsite/public_html/include/MVC/SugarApplication.php(108): SugarController->execute() #4 /home/testsite/public_html/index.php(53): SugarApplication->execute() #5 {main} 在第 180 行的 /home/testsite/public_html/download.php 中抛出

当我浏览此错误时,得到了安装此扩展程序的解决方案。我正在使用 PHP 7。

在live中添加cpanel的扩展,安全吗..由于是共享主机,会不会影响其他php项目。

当我执行 phpinfo 时发现了一些关于 mime_type 的信息。下面

default_mimetype - text/html
mbstring.http_output_conv_mimetypes - ^(text/|application/xhtml\+xml)

【问题讨论】:

    标签: php mime-types sugarcrm suitecrm


    【解决方案1】:

    此功能已被删除。在根目录下更改 download.php。将其替换为finfo_file (http://php.net/manual/en/function.finfo-file.php)

    【讨论】:

      【解决方案2】:

      您需要安装fileinfo 扩展才能使用mime_content_type。在基于 debian 的系统中,您可以通过 apt 安装它:apt-get install php-mime-type

      更多信息:http://php.net/manual/en/book.fileinfo.php

      【讨论】:

        【解决方案3】:

        我试图使用 mime_content_type() 获取文件的 mimeType,但它不起作用。

        这对我有用:

        $file = $request->file('FILE_NAME_IN_REQUEST');
        $mimeType = $file->getClientmimeType();
        

        【讨论】:

          猜你喜欢
          • 2013-01-26
          • 2011-07-17
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-04-24
          • 2016-10-11
          • 2013-09-11
          • 2013-01-26
          相关资源
          最近更新 更多