PHP7 CurlFile不存在,我已经把它放了

时间:2016-08-12 17:12:33

标签: php

$postdata = array(
                    'method'    => 'post',
                    'key'       => $apikey,
                    'file'      => new \CurlFile($filename,'image/jpg'),
                    'phrase'        => $is_phrase,
                    'regsense'      => $is_regsense,
                    'numeric'       => $is_numeric,
                    'min_len'       => $min_len,
                    'max_len'       => $max_len,
                            'is_russian'    => $is_russian
                );
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,             "http://$domain/in.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,     1);
curl_setopt($ch, CURLOPT_TIMEOUT,             60);
curl_setopt($ch, CURLOPT_POST,                true);
curl_setopt($ch, CURLOPT_POSTFIELDS,         $postdata);
$result = curl_exec($ch);

结果回复是:

未捕获的错误:在......中找不到类'CurlFile'

我在PHP7上运行。

为什么?

1 个答案:

答案 0 :(得分:0)

应正确安装curl插件。可以使用phpinfo()

验证相同内容