小编BAB*_*AFI的帖子

如何使用 Laravel http post 禁用 SSL 检查

我正在尝试使用以下代码在 laravel 中向付款端点发出发布请求

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class AddCardController extends Controller
{
    //
    public function index()
    {
        return view("addcard");
    }
    public function requestPayment(Request $request)
    {
        $paystack_key = \config("app.paystack_key");
        $url = "https://api.paystack.co/transaction/initialize";
        $email = $request->user("distributors")->email;
        $fields = [
            "email"=>$email,
            "amount"=>50*100,
            "channels"=>["card"],
            "callback_url"=>"d"
        ];
        $query = http_build_query($fields);
        $response = Http::post($url,$fields)::withHeaders(["Authorization: Bearer $paystack_key",
        "Cache-Control: no-cache",])::withOptions(["verify"=>false]);
        return $response;
    }
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.paystack.co/transaction/initialize
Run Code Online (Sandbox Code Playgroud)

我在 Apache 本地运行我的 Laravel …

php curl laravel

17
推荐指数
1
解决办法
3万
查看次数

使用 laravel 从数组中获取值

这是示例数组

Array
(
    [note] => Array
        (
            [to] => Array
                (
                    [user] => Array
                        (
                            [name] => First User
                        )

                    [abc] => 123
                    [lmn] => 4582
                )

            [from] => Jani
            [heading] => Reminder
            [body] => Array
                (
                    [abc] => 123
                )

        )

)
Run Code Online (Sandbox Code Playgroud)

我有一个像“note > to > abc”这样的字符串,并且想要“to”数组下的“abc”值。那么我怎样才能得到这个值呢?

php arrays frameworks laravel

1
推荐指数
1
解决办法
358
查看次数

标签 统计

laravel ×2

php ×2

arrays ×1

curl ×1

frameworks ×1