<?php
$c = curl_init('http://numbersapi.com/09/27');
// 告诉cURL返回字符串形式的响应,
// 而不是立即打印
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
// 执行请求
$fact = curl_exec($c);
?>
Did you know that <?= $fact ?>
浏览器执行后返回
Fatal error: Uncaught Error: Call to undefined function curl_init() in D:\PHP\Apache24\htdocs\example11-6.php:3 Stack trace: #0 {main} thrown in D:\PHP\Apache24\htdocs\example11-6.php on line 3
命令行键入
php -m
发现没有curl模块,那么如何加载curl模块呢?