LAMP Droplet Ubuntu 16.04上的Composer问题

问题描述 投票:0回答:1

我想使用nexmo平台,所以我从DigitalOcean创建了LAMP Droplet。在这一点上没有问题。之后,请在this页面上安装作曲家。

最近,当我想使用此命令安装nexmo时,

composer require nexmo/client

它已安装,但是当ı在我的index.php文件中添加了此代码时

require_once _DIR__ . '/../vendor/autoload.php';

页面未加载。

这里是我的目录...

var/www/html/index.php

var/www/html/vendor

有人可以帮我什么问题吗?

我在Internet上搜索了问题,并尝试了一些解决方案,但没有任何改变。

[composer install - composer update,等等...我尝试了这些。

php ubuntu composer-php
1个回答
0
投票

如果index.phpvendor文件夹位于同一路径,则require_once错误。它必须是:

require_once __DIR__ . '/vendor/autoload.php';

[__DIR__解析到当前文件所在的目录,因此vendor文件夹实际上位于__DIR__ . '/vendor/'

© www.soinside.com 2019 - 2024. All rights reserved.