php 错误解析错误:语法错误,意外的 T_STRING,期待 T_CONSTANT_ENCAPSED_STRING

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13960277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 06:21:32  来源:igfitidea点击:

Error Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING

phpwordpress

提问by Greg

I get this error:

我收到此错误:

"Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in [wordpress dir]/wp-content/themes/[my-theme]/functions.php on line 14"

“解析错误:语法错误,意外的 T_STRING,在第 14 行的 [wordpress 目录]/wp-content/themes/[my-theme]/functions.php 中需要 T_CONSTANT_ENCAPSED_STRING 或 '(')”

And line 14 is just a simple usecommand...

第 14 行只是一个简单的use命令......

Line 13-15:

第 13-15 行:

add_action('headway_setup_child_theme', array('HeadwaySchematic', 'init'), 1);
use mfbcaptheme\mobilebrowsertheme;
require_once 'mobilebrowsertheme.php';

This is on a client's site and it works just fine on my test site....Not sure what would cause this error.

这是在客户的站点上,它在我的测试站点上运行良好....不确定是什么导致了此错误。

回答by John Conde

Make sure they are running PHP 5.3 or later. If they are running an earlier version they won't have support for namespaces.

确保它们运行的​​是 PHP 5.3 或更高版本。如果他们运行的是早期版本,他们将不支持命名空间。