未定义的常量CURLOPT_POST用途 - 假定“CURLOPT_POST” [英] Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST'

查看:1388
本文介绍了未定义的常量CURLOPT_POST用途 - 假定“CURLOPT_POST”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过Kohana的3.2使得卷曲的要求,但我得到以下错误,当它试图访问 CURLOPT_POST 常数:

I am making a cURL request via Kohana 3.2 but I get the following error when it tries to access CURLOPT_POST constant:

Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST'

从Kohana的3.2 系统/班/ Kohana的/请求/客户机/ 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;
}

我的应用程序code:

My application code:

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

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

我已经测试了卷曲的扩展使用有效:

I have tested that curl is active as an extension using:

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

这里有什么问题吗?我使用Windows 7,PHP 5.4.12和Apache 2.4。

What is the problem here? I am using Windows 7, PHP 5.4.12, and Apache 2.4.

推荐答案

我注意到扩展= p​​hp_curl.dll 被注释掉C:\\ WAMP \\ BIN \\ PHP \\ php5.4.12 \\ php.ini中,而是通过活跃的C:\\ WAMP \\ BIN \\ apache的\\ Apache2.4.4 \\斌\\ php.ini文件

I noticed extension=php_curl.dll was commented out in C:\wamp\bin\php\php5.4.12\php.ini but active via C:\wamp\bin\apache\Apache2.4.4\bin\php.ini.

我发现,取消注释行 C:\\ WAMP \\ BIN \\ PHP \\ php5.4.12 \\ php.ini中固定我的问题。

I found that uncommenting the line in C:\wamp\bin\php\php5.4.12\php.ini fixed my issue.

这篇关于未定义的常量CURLOPT_POST用途 - 假定“CURLOPT_POST”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆