简体   繁体   English

PHP MySQLi函数在Linux上引发解析错误,但在Windows上不引发

[英]PHP MySQLi function throws parse error on Linux, but not on Windows

I have a development server setup on my home office PC that is running Apache 2.4.3 with PHP 5.3.20 on Windows Server 2012. The other server is a Ubuntu Server 12.10 running Apache 2.4.2 with PHP 5.4.16. 我在家庭办公室PC上安装了开发服务器,该服务器在Windows Server 2012上运行带有PHP 5.3.20的Apache 2.4.3。另一台服务器是运行Apache 2.4.2和PHP 5.4.16的Ubuntu Server 12.10。 (yes, I see the version difference, except I can't find anything relating to this problem) (是的,我看到了版本差异,但是找不到与该问题有关的任何东西)

MySQLi is setup and replicated on both correctly, however, this line is not throwing any errors, or anything, however the page (and source code), stops at this line: MySQLi已正确设置并复制到两者,但是,此行未引发任何错误或任何错误,但是页面(和源代码)在此行处停止:

$id = mysqli_fetch_row($query)[0];

However it works on the Linux server. 但是,它可以在Linux服务器上使用。 Am I missing an extension? 我是否错过了扩展名?

It works when I do: 当我这样做时它起作用:

$id = mysqli_fetch_row($query);
$id = $id[0];

Is there a way to enable the ability to combine the lines, without having to change everything? 有没有一种方法可以使线合并而无需更改所有内容?

Thanks. 谢谢。

PHP 5.4 has Function array dereferencing, eg foo()[0]. PHP 5.4具有对函数数组的取消引用,例如foo()[0]。

http://php.net/manual/en/migration54.new-features.php http://php.net/manual/zh/migration54.new-features.php

< 5.4 does not. <5.4不。

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

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