我通过使用 cURL 得到以下字符串。代码可以在此评论中找到。
HTTP/1.1 200 OK ID=347 Date: Tue, 19 Feb 2013 09:15:25 GMT Server:
Apache/2.2.22 (Ubuntu) Content-length: 0 Vary: Accept-Encoding
Content-Type: text/plain; charset=ISO-8859-1
现在我想要字符串中的 ID,为此我使用了 explode 从空间中创建一个数组,如下所示:
$getIdElem = explode(' ',$output);
echo '<pre>';print_r($getIdElem);
但我得到Date: with ID 字符串,而它前面有空格。打印数组的输出是:
Array
(
[0] => HTTP/1.1
[1] => 200
[2] => OK
[3] => ID=347
Date:
[4] => Tue,
[5] => 19
[6] => Feb
[7] => 2013
[8] => 09:15:25
[9] => GMT
Server:
[10] => Apache/2.2.22
[11] => (Ubuntu)
Content-length:
[12] => 0
Vary:
[13] => Accept-Encoding
Content-Type:
[14] => text/plain;
[15] => charset=ISO-8859-1
)
我不明白为什么它在爆炸功能中不包含该空间。任何人都可以帮助我吗?