我有一个奇怪的问题,很奇怪,因为在谷歌上没有任何东西出现。我试图解析一个充满HTTP状态码StatusCodes.ini的ini文件。我测试了三种不同的环境,本地(WAMP)在共享主机(Hostmonster.com)上,现在在运行CentOS w/CPanel/WHM的专用机器上进行测试。前两种环境看起来做工精细,但在专用机器上我得到一个警告:PHP parse_ini_file TC_CONSTANT警告
Warning: syntax error, unexpected TC_CONSTANT in StatusCodes.ini on line 8
运行时:
$ini = parse_ini_file('StatusCodes.ini',true);
$codes = $ini['codes'];
ini文件看起来像:
[codes] 100 = Continue 101 = Switching Protocols 200 = OK 201 = Created 202 = Accepted 203 = Non-Authoritative Information 204 = No Content 205 = Reset Content 206 = Partial Content 300 = Multiple Choices 301 = Moved Permanently 302 = Found 303 = See Other 304 = Not Modified 305 = Use Proxy 307 = Temporary Redirect 400 = Bad Request ...
如果你不想计数,204 =没有内容,是第8行。我已经把线路取出来,没有任何变化。有什么建议么?
8号线可能引用代码中的行,而不是ini文件。 – 2010-10-30 17:41:15
@Pekka,不,它是INI文件,并且方便地指向有“No”值的地方。 – salathe 2010-10-30 17:53:58