php cURL script run twice when printing return string

前端 未结 1 1598
深忆病人
深忆病人 2021-01-21 14:13

I have the following script. In the remote php script a record is added to a database table. When I leave the last line (print $html;) in this script, 2 records are added!

1条回答
  •  不思量自难忘°
    2021-01-21 14:33

    Set CURLOPT_RETURNTRANSFER to false and just do curl_exec($ch) instead of $html = curl_exec($ch). Then the curl output will be directly returned to the browser.

    0 讨论(0)
提交回复
热议问题