如何使用php get_headers只获取位置部分?
var_dump(get_headers('http://www.google.com',1));
Run Code Online (Sandbox Code Playgroud)
这个回报:
array(12) { [0]=> string(18) "HTTP/1.0 302 Found" ["Location"]=> string(21) "http://www.google.it/" ... }
Run Code Online (Sandbox Code Playgroud)
然后我用
echo (get_headers('http://www.google.com',1)["Location"];
Run Code Online (Sandbox Code Playgroud)
错误:Parse error: syntax error, unexpected '['在这一echo行
Chr*_*n P 10
$headers = get_headers('http://www.google.com',1);
echo $headers["Location"];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7447 次 |
| 最近记录: |