我安装了一个wordpress主题,但是当我激活主题时出现此错误。我不知道问题出在哪里。解析错误:语法错误,/home/content/64/7418064/html/sites/directory/wp-content/themes/directorys/framework/page-tamer/class-page-tamer.php 中意外T_FUNCTION在第 782 行
这是该特定文件中的代码摘录
public function parse_shortcode_content($shortcode) {
Page_Tamer::$pattern = get_shortcode_regex();
$shortcode_content = preg_replace_callback(
"/" . Page_Tamer::$pattern . "/s",
function ($matches) {
return $matches[5];
},
$shortcode
);
return $shortcode_content;
}
有问题的线路是function ($matches) {
有人可以帮帮我吗,我将不胜感激。谢谢
有匿名函数。他们的支持适用于 PHP 5.3 及更高版本。也许它会有所帮助:
function code_connect($matches) {
return $matches[5];
}
$shortcode_content = preg_replace_callback("/" . Page_Tamer::$pattern . "/s", 'code_connect', $shortcode);
这将以通常的方式创建一个函数 (code_connect)。