找不到显示 PHP 的类



我的索引.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 管理您的项目(生成自动加载(,则使用 kewyord 将不包括该类,您可以通过以下方式要求该文件:

require_once('path to SightengineClient file');
$t = new SightengineClient;

使用 require_once 将确保您只包含一次 文件。

最新更新