About viewing the curl source code of php

WBOY
Release: 2016-08-08 09:29:50
Original
1285 people have browsed it

After writing the c extension of php, I wanted to check out how to write the source code of other extension libraries, so as to learn how to write it, so I randomly picked a curl commonly used in php to look at it, and the result was in php's ext/ The source code of functions such as curl_setopt() or curl_setopt_array() was not found in the curl directory, but there are definitions of these functions:

It is not in streams.c, but finally I found the definitions of these functions in interface.c Encapsulation: The _php_curl_setopt() function encapsulated in interface.c, curl_setopt() or curl_setopt_array(), etc. all call this function. This function calls the curl_easy_setopt() function of libcurl, so The goal now becomes to find where curl_easy_setopt() is.

Because OS X system should have libcurl, but we can also download a copy of the source code from libcurl’s official website to view. It is different from the libcurl version in OS X system, but it should be roughly the same, so I downloaded this Version: curl-7.40.0 this version.

After searching, I found the function definition. curl_easy_setopt is defined in easy.c:

The above introduces the process of viewing the curl source code of PHP, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!