PHP:解析错误:意外的 T_DOUBLE_ARROW

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4847094/
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 16:04:22  来源:igfitidea点击:

PHP: Parse Error: unexpected T_DOUBLE_ARROW

phpsyntax-error

提问by Brian

My code gives me the error

我的代码给了我错误

Parse error: syntax error, unexpected T_DOUBLE_ARROW, expecting ')' line 208

解析错误:语法错误,意外的 T_DOUBLE_ARROW,期待 ')' 第 208 行

I keep getting this but it looks correct? Line 208 which is the second down.

我一直收到这个,但它看起来正确吗?第 208 行,这是第二次下降。

array( "name" => "Colour Scheme",
 "desc" => "Select the colour scheme for the theme",
 "id" => $shortname."_color_scheme",
 "type" => "select",
 "options" => array("blue", "red", "green"),
 "std" => "blue"),

please advise!

请指教!

Thanks

谢谢

回答by alex

T_DOUBLE_ARROWis the token for =>, so you have one which appears somewhere the parser doesn't expect it.

T_DOUBLE_ARROW是 的令牌=>,所以你有一个出现在解析器不期望的地方。

Besides that trailing ,, there is no error with the code you posted.

除了尾随,,您发布的代码没有错误。

回答by Yzmir Ramirez

Besides that trailing ,, there is no error with the code you posted. -- alex

Often errors can come up on a line, when the problem is actually right before it (for example missing ; at line end) -- Jonah

除了尾随 , 之外,您发布的代码没有错误。——亚历克斯

当问题实际上就在它之前(例如丢失;在行尾)时,错误通常会出现在一行上——Jonah

My bet is that Jonah is correct and that the error in the line above this array. From the context of the trailing ,I bet this is a mutli-dimensional array.

我敢打赌,Jonah 是正确的,并且该数组上方的行中存在错误。从尾随的上下文来看,,我敢打赌这是一个多维数组。

If you include the code around your array I bet the problem is the line above.

如果您在数组周围包含代码,我敢打赌问题出在上面的行中。

Good luck.

祝你好运。