CBOR实现在PHP5.3.3上产生错误
我使用它来打包我的C应用程序和PHP脚本中的数据。对于PHP,我已经从上面的站点下载了。它在PHP5.4.23中运行良好,但在PHP5.3.3(包括CBOREncoder.PHP)中会产生错误:CBOR实现在PHP5.3.3上产生错误,php,cbor,Php,Cbor,我使用它来打包我的C应用程序和PHP脚本中的数据。对于PHP,我已经从上面的站点下载了。它在PHP5.4.23中运行良好,但在PHP5.3.3(包括CBOREncoder.PHP)中会产生错误: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /var/www/html1/......./CBOREncoder.php on line 15 这是CBOREncoder.php的开头: <?ph
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /var/www/html1/......./CBOREncoder.php on line 15
这是CBOREncoder.php的开头:
<?php
/**
* CBOR encoder/decoder
*
* http://tools.ietf.org/html/rfc7049
* http://habrahabr.ru/post/208690/ thx man :)
*
* Class CBOREncoder
*/
class CBOREncoder
{
const
MAJOR_OFFSET = 5,
HEADER_WIPE = 0b00011111, <-- this line produces error
ADDITIONAL_WIPE = 0b11100000,
问题是PHP5.3.x不支持二进制数。这已经包含在PHP5.4中
从php网站:
已添加二进制数格式,如0b001001101
因此,CBOR不支持PHP5.3