Maison  >  Article  >  développement back-end  >  Comment convertir php en json

Comment convertir php en json

藏色散人
藏色散人original
2020-05-10 13:30:012982parcourir

Comment convertir php en json

Comment convertir php en json ?

Comment convertir un tableau PHP en json

Fonction utilisée pour convertir un tableau PHP en chaîne au format JSON :

Comment convertir php en json

Exemple de démonstration, définir un tableau

Comment convertir php en json

Encoder le tableau dans une chaîne au format json

Comment convertir php en json

Sortie encodage Après avoir enregistré la chaîne au format json

Comment convertir php en json

, affichez la chaîne de sortie au format JSON dans le navigateur

Comment convertir php en json

Autre notes sur l'utilisation de json_encode()

Comment convertir php en json

Recommandé : "Tutoriel vidéo PHP"

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn