问题描述
我最近将一个新的依赖项上载到正在处理的PHP应用程序中,现在我在Postman中不断收到以下错误消息
I recently uploaded a new dependency to a PHP app I am working on and I am now continually getting the following error in Postman
致命错误:在中找不到接口"Psr \ Container \ ContainerInterface"在线上/var/www/html/api/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php 13
Fatal error: Interface 'Psr\Container\ContainerInterface' not found in/var/www/html/api/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php on line13
我已经更新了作曲家以及许多其他内容,但似乎仍然无法找出问题所在. (也不确定是否表示错误是由于index.php文件或container.php文件引起的)
I have updated composer as well as a multitude of other things and still cannot seem to pinpoint the issue. (Also not sure if it means the error is with the index.php file or the container.php file)
这是container.interface.php文件中的代码
Here is the code from the container.interface.php file
<?php
/**
* @license http://www.opensource.org/licenses/mit-license.php MIT
(see the LICENSE file)
*/
namespace Interop\Container;
use Psr\Container\ContainerInterface as PsrContainerInterface;
/**
* Describes the interface of a container that exposes methods to
read its entries.
*/
interface ContainerInterface extends PsrContainerInterface
{
}
这是我的index.php文件中的初始代码
And here is the initial code from my index.php file
<?php
ini_set('display_errors', 1);
// Include the SDK using the Composer autoloader
require 'vendor/autoload.php';
use Kreait\Firebase\Factory;
use Kreait\Firebase\ServiceAccount;
// Includes ;
require_once( 'config/database.php' );
require_once( 'controller/base.php' );
//$app = new Slim\App();
$app = new Slim\App(['settings' => ['displayErrorDetails' => true]]);
$twilio = new Twilio\Rest\Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN);
$serviceAccount = ServiceAccount::fromJsonFile('my_file.json');
$firebase = (new Factory)->withServiceAccount($serviceAccount)-
>withDatabaseUri('my_firebase_website')->create();
推荐答案
解决方案:我正在利用filezilla从本地计算机上的供应商文件夹中传输更新的依赖项,并且在此过程中,我下载了错误的autoload.php文件
Solution: I was utilizing filezilla to transfer updated dependencies from my vendor folder on my local machine & in the process I was downloaded the wrong autoload.php file
这篇关于找不到运行时接口"Psr \ Container \ ContainerInterface"的php错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!