将字符串关闭评估为“实际”关闭

时间:2019-02-12 21:09:42

标签: php string closures

我试图将闭包参数传​​递给函数。闭包在我的数据库中,并存储为字符串。

当我将闭包传递给函数时,出现错误:

  

传递给... :: __ construct()的参数1必须是Closure的实例,给定字符串...

我的波纹管闭合器只是一个字符串

function () use ($titleItem) {
            $titleValue = $titleItem->getExtractedValue();
            $this->setAttributes('a', ['target' => '_blank', 'rel' => 'nofollow']);
            \ToolBox::replaceImagesAttributes($this, $titleValue, 'storage/path');
};

有什么办法可以将该字符串转换为真正的闭包吗?

0 个答案:

没有答案
相关问题