【发布时间】:2020-07-01 18:43:40
【问题描述】:
我正在使用无法升级的带有 PHP 5.4 的旧系统。我必须通过添加一个名为 FPDF/FPDI 的 PDF 文件生成库来做一个小改动:
protected function getPdfParserInstance(StreamReader $streamReader)
{
/** @noinspection PhpUndefinedClassInspection */
if (\class_exists(FpdiPdfParser::class)) {
/** @noinspection PhpUndefinedClassInspection */
return new FpdiPdfParser($streamReader);
}
return new PdfParser($streamReader);
}
问题在于 ::class 是在 PHP 5.5 中添加的,正如 in this question 所解释的那样。
问题是:需要对该函数进行哪些更改才能在 PHP 5.4 中工作?
【问题讨论】: