在PHP5.4上使用Google翻译的API报错

/**********************************************************************
 *             在PHP5.4上使用Google翻译的API报错
 * 说明:
 *     本来是想使用百度的翻译API,结果百度翻译:红色 --> gules。都不知道
 * 还能说什么好了。
 *
 *                                2018-3-16 深圳 宝安西乡 曾剑锋
 *********************************************************************/

一、参考文档:
    1. Php 5.4 Version Not Working
        https://github.com/Stichoza/google-translate-php/issues/38

二、错误现象:
    Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) in xxx/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php on line 104

三、解决办法:
    选择大于等于5.5版本的PHP。
原文地址:https://www.cnblogs.com/zengjfgit/p/8583028.html