不要回声cURL


94

当我使用此代码时:

$ch = curl_init($url);
$statuses = curl_exec($ch);
curl_close($ch);

返回了我想要的内容,但是如果我只使用它,$statuses则会在页面上回显。

我该如何阻止呢?

Answers:




0

除了接受的答案外,请确保未将CURLOPT_VERBOSE设置为true(如果添加了此选项)

curl_setopt($ch, CURLOPT_VERBOSE, true );

即使CURL_RETURNTRANSFER设置为true,也会从cUrl中输出

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.