简体   繁体   English

php5.3的会话函数语法错误

[英]Syntax error with session function on php5.3

The following function works on php 5.6 but gives error on php 5.3 which is the version of the cpanel im using. 以下函数在php 5.6上有效,但在php 5.3(这是cpanel im正在使用的版本)上给出错误。 im unable to update the cpanel php version so i need to find a workaround.. 我无法更新cpanel php版本,所以我需要找到一种解决方法。

 $url =isset($_SESSION['url']) ? $_SESSION['url'] : [];

the error is: 错误是:

Parse error: syntax error, unexpected '[' in /home/mydomain/public_html/mypage.php on line 7

any workaround is appreciated, thanks in advance. 任何变通办法表示赞赏,在此先感谢。

Use array() instead of []. 使用array()代替[]。 Yeah, it's PHP, not JavaScript. 是的,它是PHP,而不是JavaScript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM