JS transmet le tableau au backend PHP

Le front-end ne peut pas transmettre directement le tableau au back-end. Il doit d'abord convertir le tableau au format de chaîne JSON. PHP reçoit la chaîne JSON puis la convertit en tableau pour l'utiliser.

1. JS convertit le tableau en chaîne JSON

JSON.stringify(data)

2. PHP convertit les chaînes JSON en tableaux

json_decode($_GET["data"], true);

 

Je suppose que tu aimes

Origine blog.csdn.net/marsur/article/details/106053064
conseillé
Classement