在網上下載了一個類比登陸discuz論壇的php程式範例,試運行時出現“Call to undefined function curl_init”這個錯誤提示,沒有定義的函數,也就是php還沒開啟對curl_init函數的支援。Google了一番終於解決了,方法如下:
以windows下的php+apache為例。
首先,開啟php.ini,找到“extension=php_curl.dll”,然後去掉前面的“;”注釋,重啟apache即可。
如果還出現此類問題,先檢查php.ini的extension_dir值是哪個目錄,在那個目錄下檢查有無php_curl.dll,沒有的話請下載php_curl.dll,再把php目錄中的libeay32.dll和ssleay32.dll拷到c:\windows\system32裡面,重啟apache,OK!
在Ubuntu 下運行php,總是提示Call to undefined function curl_init(),原因沒有安轉:php5-curl
與curl相關的內容見:http://packages.ubuntu.com/zh-cn/intrepid/php5-curl
CURL is a library for getting files from FTP, GOPHER, HTTP server.
PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dinamically generated pages quickly. This version of PHP5 was built with the Suhosin patch.
H1>
(PHP 4 >= 4.0.2)
curl_init -- 初始化一個CURL會話
描述
int curl_init ([string url])
curl_init()函數將初始化一個新的會話,返回一個CURL控制代碼供curl_setopt(), curl_exec(),和 curl_close() 函數使用。如果選擇性參數被提供,那麼CURLOPT_URL選項將被設定成這個參數的值。你可以使用curl_setopt()函數人工設定。
例 1. 初始化一個新的CURL會話,且取回一個網頁
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "http://www.zend.com/");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch);
?>
參見:curl_close(), curl_setopt()
http://www.bkjia.com/PHPjc/322666.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/322666.htmlTechArticle在網上下載了一個類比登陸discuz論壇的php程式範例,試運行時出現“Call to undefined function curl_init”這個錯誤提示,沒有定義的函數,也就是...