【问题标题】:failed loading cafile stream加载cafile流失败
【发布时间】:2020-02-04 12:58:20
【问题描述】:

尝试在 localhost 中运行应用程序时,我加载 cafile 流失败:`C:\wamp64\bin\php\php7.2.18\extras\ssl\cacert.pem' 但我设置了我的 php.ini:

curl.cainfo ="C:\wamp64\bin\php\php7.2.18\extras\ssl\cacert.pem"
openssl.cafile="C:\wamp64\bin\php\php7.2.18\extras\ssl\cacert.pem"

我的代码:-

<?php



use Illuminate\Support\Carbon;
use Intervention\Image\Facades\Image;
use Goutte\Client;

Route::get('/', function () {
    $client = new Client();

    $crawler = $client->request('GET', 'https://laracasts.com/skills/laravel');
    $crawler->filter('img')->each(
        /**
         * @param $node
         */
        function ($node) {

            $currentData =  carbon::now()->toDateString();
            $img =  $node->attr('src');
            $imageName = pathinfo($img, PATHINFO_EXTENSION);
            $image = $currentData . "-" . uniqid() . "." . $imageName;

            $file = file_get_contents('https://laracasts.com/skills/laravel');



            //     $save =file_put_contents( public_path('image/'.$image),$file);


        }
    );
    return view('welcome');
});


我是一个学习编码的新手,请在这方面帮助我。

【问题讨论】:

  • 请添加您的代码

标签: php ssl curl


【解决方案1】:

您的 php.ini 包含智能引号(而不是 ")。这些引号被解释为文件名的一部分,使其无法访问。从 Internet 复制粘贴代码或配置时,请务必注意这些。

【讨论】:

  • 感谢您的回复,我按照您的建议更改了("),但仍然出现此错误。
【解决方案2】:

是的,刚刚解决了,我改名为

ca-bundle.crt

而不是

cacert.pem

它有效!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-09
    • 2013-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-04
    • 2019-07-03
    相关资源
    最近更新 更多