Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch信息查看功能 #2

Open
kaixindeken opened this issue Jul 2, 2020 · 0 comments
Open

ch信息查看功能 #2

kaixindeken opened this issue Jul 2, 2020 · 0 comments

Comments

@kaixindeken
Copy link

kaixindeken commented Jul 2, 2020

可以整一个查看curl里ch信息的功能,或者将该信息整合到data里也可。
不是所有语言都有php curl功能,该issue的提出旨在方便其他语言和框架手动实现curl以及类似功能,有助于拓展工作室后端技术栈。
望采纳。
(ch指的是以下代码的$ch)
(data指的是以下代码的$data)
(以下代码在Api.php文件的25至39行)

private function _request($url, $postData = null) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    if ($postData) {
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
    }

    $data = curl_exec($ch);
    curl_close($ch);

    return json_decode($data);
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant