当前位置:网站首页>How to use JSON data format
How to use JSON data format
2022-06-23 17:48:00 【It workers】
json_encode() On variables JSON code
json_decode() Yes JSON Format of the string , Convert to PHP Variable
json_last_error Returns the last error that occurred
Resource type cannot be converted to json Format , Nor can it be converted to serialize data format , Similar to file identification .
Json Data format and serialize Similarities and differences of data formats
The same thing
1、 Is to convert other data types into a string that can be transferred
2、 It's all structural data
Difference
1、Serialize Serialized data format Save the original data type
2、JSON The data format should be more concise than Serialize Data format after serialization
Use scenarios :
1、JSON Suitable for large amount of data , It is not required to keep the original data type
2、Serialize Suitable for storing data strings with encryption , Prevent data from being intercepted, deserialized and cracked in the middle of the process
<?php
header("Content-type:text/html; charset=utf-8"); // Declaration code
function createHtmlTag($tag = ""){
echo "$tag";
}
createHtmlTag("Www.aseoe.Com");
createHtmlTag("JSON and serialize contrast ");
$member = array("site","tree"); // Define an array
var_dump($member); // Print
$jsonObj = json_encode($member); // It can be interpreted as json data format
$serializeObj = serialize($member); // It can be interpreted as serialize data format
createHtmlTag($jsonObj); // There is no need to save the data format
createHtmlTag($serializeObj); // Can encrypt the transmitted data , Prevent interception
?> 边栏推荐
- Li Kou daily question - day 25 -495 Timo attack
- 创新技术领航者!华为云GaussDB获颁2022年云原生数据库领域权威奖项
- Tencent three sides: how to duplicate 4billion QQ numbers?
- [JS reverse hundred examples] pedata encryption information and zlib Application of gunzipsync()
- C#与数据库连接
- 解答01:Smith圆为什么能“上感下容 左串右并”?
- qYKVEtqdDg
- Freemark uses FTL files to generate word
- Robot Orientation and some misunderstandings in major selection in college entrance examination
- 单火线设计系列文章10:拓展应用-单火开关实现双控
猜你喜欢

How to make sales management more efficient?

10分钟后性能测试瓶颈调优!想进大厂这个必须会

FPN characteristic pyramid network

The official Chinese course of zero foundation introduction jetpack compose is coming

Meituan Sanmian: how do you understand the principle of redis master-slave replication?
NLP paper reading | improving semantic representation of intention recognition: isotropic regularization method in supervised pre training

Rongyun: let the bank go to the "cloud" easily

C # connection to database

千呼万唤,5G双卡双通到底有多重要?

How to configure MySQL log management
随机推荐
Ctfshow PHP features
Intelligent supply chain collaborative management solution for logistics industry
[network communication -- webrtc] analysis of webrtc source code -- supplement of pacingcontroller related knowledge points
【网络通信 -- WebRTC】WebRTC 源码分析 -- 接收端带宽估计
C. Phoenix and Towers-Codeforces Global Round 14
How about stock online account opening and account opening process? Is online account opening safe?
《MPLS和VP体系结构》
Bypass rights
How to open an account through online stock? Is online account opening safe?
Spdlog logging example - create a logger using sink
Importance of ERP management system
Database Experiment 2 query
【30. 串联所有单词的子串】
MySQL installation, configuration and uninstall
Company offensive operation guide
B. AND 0, Sum Big-Codeforces Round #716 (Div. 2)
MySQL事务及其特性与锁机制
How to configure MySQL log management
Hapoxy-集群服务搭建
C # connection to database