mercredi 15 septembre 2021

how to fix error Trying to access array offset on value of type null in laravel

i know this question is asked but my scenario is different my array is

  $data = array(
            'merchantId'        => $merchantId,
            'qrCode'            => $qrCode,
     );

in next step i am calling jeson data and api

    $json_data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
    $signed_data = $data;
    $signed_data['sign'] = Encryption::generateSignature($json_data,storage_path().self::MERCHANT_PRIVATE_KEY);

but i get this error

 public static function verifySignature(string $data, string $key)

{

    $data = json_decode($data, true, 512, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);

    $signature = $data['sign']; //here i get error on this line with Trying to access array offset on value of type null

can some one help me to fiure it out i never integrate api so i dont know this error



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire