我正在网站上工作。我正在使用外部类进行一些图像处理。它在mamp
服务器上运行良好,但在主机上我收到错误
Parse error: syntax error, unexpected ':' in
/home/a3526504/public_html/post/src/abeautifulsite/SimpleImage.php on line 251
该行:
$height = $height ?: $width;
服务器正在运行php:5.2
解决方案: 我换了东道主。我之前使用过000webhost,显然已经死了,他们把它换成了hostinger。他们运行php 5.6。
答案 0 :(得分:1)
$height = $height ?: $width;
这只适用于php 5.3及以上版本。