Home  >  Article  >  Backend Development  >  curl_exec 返回值?

curl_exec 返回值?

WBOY
WBOYOriginal
2016-06-06 20:24:551341browse

curl_exec 这个函数返回的数据直接显示在浏览器中了,怎么把数据保存在变量中

回复内容:

curl_exec 这个函数返回的数据直接显示在浏览器中了,怎么把数据保存在变量中

<code class="php">$req = curl_init($url);
curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($req); // 保存在 $res 里</code>

直接写个变量赋值不就行了吗$lines_string=curl_exec($ch);没有输出执行,还能直接显示到浏览器中吗?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn