问题
My index.php file exist in public_html/myapp/files directory,And i am trying to use library which exist in same directory public_html/myapp/files. But I am getting error
Class 'SightengineClient' not found in /home/public_html/myapp/files/index.php on line 7
Where i am wrong ? Here is my code
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);
回答1:
Using the use kewyord will not include the class if you are not managing your project with composer(generating the autoload ) will you can require the file in this way :
require_once('path to SightengineClient file');
$t = new SightengineClient;
Using require_once will ensure that you are include only one time the file .
来源:https://stackoverflow.com/questions/55511242/class-not-found-showing-php