我想制作一个抽象的cronjob,因为我在我的数据库中有一个列,我可以获得我需要包含的类的名称。 (exportClass) - >我的问题是,因为我只得到$ className,其中包含我需要包含的页面名称 - >我怎么称呼它?
这是我尝试称之为
$className = $result['exportClass'] . 'Import';
$className = strtoupper(substr($className, 0, 1). substr($className,1));
include $className::class;
$this->remote_file = $className::class->getRemoteFile();
$this->tableName = $className::class->getTableName();
$this->protocol = $className::class->getProtocol();
$this->error = $className::class->getError();
这是一个例子,如果它不是一个抽象的页面(这是有用的)
if ($result['exportClass'] == 'contract') {
include ContractImport::class;
$this->remote_file = ContractImport::class->getRemoteFile();
$this->tableName = ContractImport::class->getTableName();
$this->protocol = ContractImport::class->getProtocol();
$this->error = ContractImport::class->getError();
}