ErrorException: file_get_contents( http://apis.map.qq.com/ws/geocoder/v1/?location=30.879607817556,104.24672753578&get_poi=1&key=O2RBZ-HY5WU): failed to open stream: Connection timed out in /data/www/xxxx.com/cc.xxxx.com/app/Http/Controllers/BaseController.php:1754 Stack trace:
一直报错,发现问题是&get_poi=1& 中的&符号被转译掉了,qq 地图不认
1
crab Oct 16, 2017
用 %26 试下
|
2
f2f2f Oct 16, 2017
('') 单引号
|
3
VgV Oct 16, 2017
你是怎么传递给 file_get_contents 里面的? get ?那建议先把&换成其他字符串,传进去的的时候再替换回来。post 一般没事
|
4
silenceeeee Oct 16, 2017
```
$url = 'http://apis.map.qq.com/ws/geocoder/v1/?location=30.879607817556,104.24672753578&get_poi=1&key=O2RBZ-HY5WU'; $ret = file_get_contents($url); var_dump($ret); ``` 没啥问题啊。 |
5
klgd Oct 16, 2017
file_get_contents 不会去转义 url 吧,是不是你获取到的 url 已经被转义了,用 htmlspecialchars_decode 反转义一下试试
|
6
vus520 Oct 16, 2017
`curl xxxxx.ooo`
难道只有我懂这个技能么 |