【发布时间】:2019-04-04 08:29:18
【问题描述】:
我的 index.php 文件存在于public_html/myapp/files 目录中,我正在尝试使用存在于同一目录public_html/myapp/files 中的库。但我收到错误
在中找不到类“SightengineClient” /home/public_html/myapp/files/index.php 在第 7 行
我哪里错了? 这是我的代码
namespace Tests;
use SightengineClient;
$client = new SightengineClient('myapikey', 'secretkey');
$output = $client->check(['nudity'])->set_url('https://d3m9459r9kwism.cloudfront.net/img/examples/example7.jpg');
echo "<pre>";print_R($output);
【问题讨论】:
-
您的要求/包含在哪里?
-
你在项目中使用 composer 吗?
-
@MohammedYassineCHABLI :不,我只是打开我的 cpanel 并从 github 上传下载的代码
-
您必须在文件中包含定义类 SightengineClient 的文件。 使用关键字不会导入类定义
-
试试这个
$client = new \SightengineClient('myapikey', 'secretkey');