如何使用 php get_headers 仅获取位置部分?
var_dump(get_headers('http://www.google.com',1));
这个回报:
array(12) { [0]=> string(18) "HTTP/1.0 302 Found" ["Location"]=> string(21) "http://www.google.it/" ... }
然后我用
echo (get_headers('http://www.google.com',1)["Location"];
错误:Parse error: syntax error, unexpected '['
在这一echo
行