PHP对讲机无法正常工作

PHP对讲机无法正常工作

本文介绍了更新作曲者后,PHP对讲机无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近使用作曲家进行了更新.更新后,我在php文件中收到错误,在该处我向对讲机发送数据.这是错误:

i recently updated using composer. After updating I am getting error in php file , where I am sending data to intercom. This is the error :

Fatal error: Class 'Intercom\IntercomBasicAuthClient' not found in <filename>

我在这里发现了类似的问题 Symfony仅在开发和生产服务器上例外(未找到类).但无法确切了解如何解决该问题.我尝试同时使用大写和小写形式的对讲机,但问题仍未解决.

I found a similar problem here Symfony Exception (Class not found) only on development and production servers. But couldn't understand exactly how to solve the issue.I tried using intercom in Uppercase as well as lowercase, but problem is not solved.

在我的installed.json中,我发现了这个问题:

In my installed.json I found this :

"autoload": {
            "psr-4": {
                "Intercom\\": [
                    "src"
                ]
            }
        }

这是对讲文件的目录位置:

And this is the directory location of intercom files :

/public_html/vendor/intercom/intercom-php/src

当我挖掘更多的作曲家文件(试图了解类是如何包含所有类)时,我在autoload_namespaces.json中碰到了这段代码

When I dig into more composers file(was trying to understand how classes are included and all), I came across this code in autoload_namespaces.json

<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'libphonenumber' => array($vendorDir . '/giggsey/libphonenumber-for-php/src'),
    'PhpAmqpLib' => array($vendorDir . '/php-amqplib/php-amqplib'),
);

libphonenumber和phpamqplib是我使用composer安装的两个库,这里缺少对讲机.

libphonenumber and phpamqplib are two libraries that I installed using composer, and intercom is missing here.

所以我完全感到困惑,实际的问题是什么.是对讲机库在autoload_namespace中丢失,还是大写-小写问题?还是什么?

So I am totally confused, what is the actual problem.Is the intercom library missing in autoload_namespace or is it the uppercase-lowercase issue or what.

这是我在autoload_psr4.php中找到的

This I found in autoload_psr4.php

<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
    'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'),
    'Intercom\\' => array($vendorDir . '/intercom/intercom-php/src'),
    'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
    'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
    'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
    'Aws\\' => array($vendorDir . '/aws/aws-sdk-php/src'),
);

这就是我将对讲机包含在我的php文件中的方式:

And this is how I am including Intercom in my php file :

use Intercom\IntercomBasicAuthClient;

推荐答案

我自己弄清楚了.问题出在PHP版本上.我使用的是php-5.5,对讲机库严格要求PHP版本> = 5.6.

I figured it out myself.The problem was with PHP version. I am using php-5.5 and the intercom library strictly requires PHP version >= 5.6 .

使用对讲API创建我自己的库,以使其适用于php-5.5.

Created my own library using Intercom APIs to get it work for php-5.5.

这篇关于更新作曲者后,PHP对讲机无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 20:14