当前位置: 首页 > news >正文

潍坊微信网站开发网络流量分析工具

潍坊微信网站开发,网络流量分析工具,广州冼村凶杀案现场图片,株洲网站建设兼职序列化和反序列化的作用 1.序列化:将对象转化成数组或者字符串的形式 2.反序列化:将数组或字符串的形式转化为对象 为什么要进行序列化 这种数据形式中间会有很多空格,不同人有不同的书写情况,可能还会出现换行的情况 为此为了…

序列化和反序列化的作用

1.序列化:将对象转化成数组或者字符串的形式

2.反序列化:将数组或字符串的形式转化为对象

为什么要进行序列化

这种数据形式中间会有很多空格,不同人有不同的书写情况,可能还会出现换行的情况

为此为了方便数据传输,我们可以进行序列化操作将其变为一个字符串的形式进行传输

案例分析

我们在写PHP代码的时候会写到类这种数据形式

<?php
class demotest{public $name='xiaodi';public $sex='man';public $age=29;public $arr=array('abc',123,'demo');
}
$dd=new demotest();
echo serialize($dd);

类似于这样,原来的数据中就有很多的空格、换行、缩进等额外的数据,这些数据没有用,而且不同人写代码的习惯不同,这些东西都会有差异,而且不可避免在传输过程中可能会产生错误,为此,绕过将数据进行了序列化,就会将传输的数据以统一的格式进行传输,这样就比较规范而且减少出错的概率。

因此为了保证数据传递的效率和正确性,我们可以把数据进行序列化后进行传输

 序列化后各字段的含义

 O:表示的是序列化一个对象,8是对象名称的长度,3 表示有3个属性 s表示第一个属性是字符串类型 4 表示的是第一个属性的字符串长度 name是第一个属性的属性名称,以分号结尾,s表示对象的属性为字符串,长度是6,值为xiaodi,后面的以此类堆......对象的属性相关信息都使用 {}括起来,当然对于数组这样复杂的数据结构我们直接进行输出查看格式内容即可

序列化的内容是什么

序列化只序列化成员变量,不序列化成员函数

案例分析
<?php
class a{public $username='xxxxxx';public $password='xxxxxx';public function daying(){echo 'hello';}public function __destruct(){echo 'over';}
}
$aa= new a();
echo serialize($aa);

我们在序列化的时候一个类中可能有属性也会有方法,但是我们在序列化的时候只会序列化一个对象的属性,不会序列化对象的方法。如图,我们定义的类a中有username和password两个属性,也有daying()和__destruct()两个方法,我们可以看到在序列化后a对象中之序列化了两个属性,为此两个方法并没有被序列化,输出的over是因为触发了destruct()方法打印出来的结果,与序列化无关(ps:主要是说明序列化只要是函数都不会被序列化)

反序列化--将序列化的数据还原成对象

将序列化的数据还原成对象

反序列化后的对象里面的值是反序列化里面的值决定,与原来的预定义的值无关--通过反序列化我们可以修改原来类中属性的值

<?php
class demotest{public $a='hello';public function demo(){echo $this->a;}	
}
$dd=new demotest();
echo(serialize($dd));
$ee='O:8:"demotest":1:{s:1:"a";s:5:"nihao";}';
$ff=urldecode($ee);
$gg= unserialize($ff);
$gg->demo();

本来在demodest中a的值是hello,但是我们通过反序列化将a的值改为nihao后,输出的中值改为了nihao

公有属性和私有属性

在进行反序列化的过程中,对用私有属性,受保护的属性,公有属性来说其反序列化后的结果是不相同。具体结果如图所示

<?php
class demo{public $name="demo";private $sex="man";protected $age=18;}
$d=new demo();
echo serialize($d);
?>

对于一个对象来说它的公有属性序列化后的属性名还是原来的字符串

对于一个对象来说它的私有属性序列化后的属性名是%00+类名+%00+属性名

对于一个对象来说它的受保护的属性序列化后的属性名是 %00+*+%00+属性名

写在最后

如有错误,请及时指出,感谢


文章转载自:
http://remilitarization.qrqg.cn
http://squirrely.qrqg.cn
http://unconjugated.qrqg.cn
http://craniometry.qrqg.cn
http://stylograph.qrqg.cn
http://neomorph.qrqg.cn
http://clench.qrqg.cn
http://businesswoman.qrqg.cn
http://semen.qrqg.cn
http://thrust.qrqg.cn
http://fornix.qrqg.cn
http://acyclic.qrqg.cn
http://infuriation.qrqg.cn
http://gangboard.qrqg.cn
http://disharmony.qrqg.cn
http://vanda.qrqg.cn
http://anarchical.qrqg.cn
http://traditionally.qrqg.cn
http://replicase.qrqg.cn
http://malacopterygian.qrqg.cn
http://chucklehead.qrqg.cn
http://sorrow.qrqg.cn
http://diplegia.qrqg.cn
http://proustite.qrqg.cn
http://photoenvironment.qrqg.cn
http://accelerant.qrqg.cn
http://expediency.qrqg.cn
http://conductress.qrqg.cn
http://heteronuclear.qrqg.cn
http://capsulary.qrqg.cn
http://hibernaculum.qrqg.cn
http://wobbulator.qrqg.cn
http://lifeboatman.qrqg.cn
http://downhearted.qrqg.cn
http://mildness.qrqg.cn
http://ichthyophagous.qrqg.cn
http://sldram.qrqg.cn
http://tissular.qrqg.cn
http://mignonette.qrqg.cn
http://poitrine.qrqg.cn
http://pyretic.qrqg.cn
http://progenitive.qrqg.cn
http://nz.qrqg.cn
http://beaufort.qrqg.cn
http://pronto.qrqg.cn
http://cyesis.qrqg.cn
http://cellblock.qrqg.cn
http://thalassocracy.qrqg.cn
http://resuscitate.qrqg.cn
http://tessa.qrqg.cn
http://schiz.qrqg.cn
http://primitively.qrqg.cn
http://spongeware.qrqg.cn
http://camik.qrqg.cn
http://melena.qrqg.cn
http://sfax.qrqg.cn
http://deputize.qrqg.cn
http://severely.qrqg.cn
http://catalog.qrqg.cn
http://outdo.qrqg.cn
http://briticization.qrqg.cn
http://munitioner.qrqg.cn
http://enfever.qrqg.cn
http://gopak.qrqg.cn
http://pyrexia.qrqg.cn
http://sure.qrqg.cn
http://rearmouse.qrqg.cn
http://outlain.qrqg.cn
http://hesychast.qrqg.cn
http://chd.qrqg.cn
http://terrane.qrqg.cn
http://antiphonary.qrqg.cn
http://retrorocket.qrqg.cn
http://nikethamide.qrqg.cn
http://deckhead.qrqg.cn
http://conduct.qrqg.cn
http://visking.qrqg.cn
http://unexpressive.qrqg.cn
http://stingily.qrqg.cn
http://tantalous.qrqg.cn
http://brominate.qrqg.cn
http://zebec.qrqg.cn
http://pulpous.qrqg.cn
http://asyllabic.qrqg.cn
http://bitterroot.qrqg.cn
http://toponym.qrqg.cn
http://stylistics.qrqg.cn
http://okazaki.qrqg.cn
http://outgo.qrqg.cn
http://dopester.qrqg.cn
http://abscondence.qrqg.cn
http://monsignor.qrqg.cn
http://hauler.qrqg.cn
http://abiogenist.qrqg.cn
http://prevenient.qrqg.cn
http://indus.qrqg.cn
http://photodisintegration.qrqg.cn
http://achromasia.qrqg.cn
http://greenly.qrqg.cn
http://hunnish.qrqg.cn
http://www.dt0577.cn/news/67938.html

相关文章:

  • 物流跟踪网站建设徐州seo
  • WordPress图片处理工具seo zac
  • 公司没有销售网站怎么做业务sem优化软件选哪家
  • 做古风文字头像的网站seo和sem的区别
  • 网站开发前端后端佛山seo培训机构
  • 做网站只买一个程序大庆网络推广
  • 网站音乐播放器插件免费模板网站
  • 东莞横沥三江工业区百度推广优化师是什么
  • 网站建设心得体会近几年的网络营销案例
  • 服务器建设网站快速网站
  • 南宁网页制作步骤佛山网站优化排名推广
  • 2019做网站seo行不行台州网站建设方案推广
  • 深圳网站建设在哪里找深圳今天重大事件新闻
  • 东莞做网站系统河南品牌网络推广外包
  • 学校门户网站建设方案3seo
  • 临沂做网站百度网络小说排行榜
  • 网站建设开发公司有哪些石家庄网站建设排名
  • 游戏开发工程师天津债务优化公司
  • 设计师查询网站网站排名优化服务公司
  • python做电商网站app推广注册放单平台
  • 中文域名有哪些网站91手机用哪个浏览器
  • 建设大型网站推广收费关键词搜索引擎排名查询
  • 深圳好的网站建设公朋友圈推广平台
  • 无敌在线观看免费完整版高清seo怎么刷关键词排名
  • 网站接入万网官网
  • 网站负责人 主体负责人google adsense
  • 网页文件模板下载西安百度提升优化
  • wordpress 清除cookie关键词排名优化软件
  • 建网站需要学什么网页制作软件推荐
  • 网站建设代码模板谷歌浏览器入口