我在第 77 行的 laravel 函数 /vendor/guzzlehttp/psr7/src/functions.php 上有错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31367442/
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
i have error in laravel on function /vendor/guzzlehttp/psr7/src/functions.php on line 77
提问by Tirdad
I upload laravel 4 files on shared server and then i see this error.
我在共享服务器上上传了 laravel 4 文件,然后我看到了这个错误。
Parse error: syntax error, unexpected '[' in . /vendor/guzzlehttp/psr7/src/functions.php on line 77
解析错误:语法错误,意外的 '[' in . /vendor/guzzlehttp/psr7/src/functions.php 第 77 行
in line 77:
在第 77 行:
function stream_for($resource = '', array $options = [])
function stream_for($resource = '', 数组 $options = [])
回答by jedrzej.kurylo
Short array syntax []was added in PHP 5.4, so I guess you're running some older version of PHP on the shared server. Normally replacing []with array()would help, but here it is an external vendor package so it's not advised to modify the code as changes would be overwritten when vendor package is updated. Other than that the only way to fix that issue is to use newer version of PHP.
PHP 5.4 中添加了短数组语法[],因此我猜您正在共享服务器上运行一些旧版本的 PHP。通常替换[]与阵列()会有所帮助,但在这里它是一个外部供应商包,因此它未建议修改代码,当供应商包被更新的变化将被覆盖。除此之外,解决该问题的唯一方法是使用较新版本的 PHP。