gpt4 book ai didi

php - 使用未定义常量 CURLOPT_POST - 假定为 'CURLOPT_POST'

转载 作者:可可西里 更新时间:2023-11-01 12:31:21 26 4
gpt4 key购买 nike

我正在通过 Kohana 3.2 发出 cURL 请求,但当它尝试访问 CURLOPT_POST 常量时出现以下错误:

Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST'

来自 Kohana 3.2 system/classes/kohana/request/client/curl.php

public function _set_curl_request_method(Request $request, array $options)
{
switch ($request->method()) {
case Request::POST:
$options[CURLOPT_POST] = TRUE;
break;
case Request::PUT:
$options[CURLOPT_PUT] = TRUE;
break;
default:
$options[CURLOPT_CUSTOMREQUEST] = $request->method();
break;
}
return $options;
}

我的申请代码:

$request = Request::factory($uri);
$request->query('key', $key);
$request->post($params);
$request->method(Request::POST);

// fails here
$response = $request->execute();

我已经测试过 curl 作为一个扩展是活跃的,使用:

if (in_array  ('curl', get_loaded_extensions()))
{
echo '1';
}
else
{
echo '0';
}

这里有什么问题?我使用的是 Windows 7、PHP 5.4.12 和 Apache 2.4。

最佳答案

首先,让我们检查您的服务器上是否安装了 php-curl

aptitude search php-curl

或者 aptitude 搜索 php5.6-curl

如果还没有安装,让我们安装它

sudo apt-get install php5.6-curl

关于php - 使用未定义常量 CURLOPT_POST - 假定为 'CURLOPT_POST',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22713591/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com