解析错误:语法错误,意外的"[",应为“)" [英] Parse error: syntax error, unexpected '[', expecting ')'

查看:231
本文介绍了解析错误:语法错误,意外的"[",应为“)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个行代码

$media = $dc->thumbnail->attributes()['url'];

在我的本地(WAMP)php 5.4.3上运行良好 但是当我将其托管在服务器cpanel上时,就会出现此错误

runs fine on my local (WAMP) php 5.4.3 but when i host it on my server cpanel then it gives this error

Parse error: syntax error, unexpected '[', expecting ')'

我服务器上的php版本是5.2.17

the php version on my server is 5.2.17

我没有发现任何问题,请帮助

i dnt see any problem with it, please help

推荐答案

您需要运行PHP 5.4+才能使用速记数组

You need to be running PHP 5.4+ to use shorthand arrays

这篇关于解析错误:语法错误,意外的"[",应为“)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆