这是 json 以及如何用 php 变量替换值? [英] is this json and how to replace values with php variables?

查看:33
本文介绍了这是 json 以及如何用 php 变量替换值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有不同的 php 变量,其中包含我想放入 mysql 数据库中的一个表中的数据.问题是我需要以特定格式放置内容,以便链接到数据库的另一个也可以使用它.我不知道这是什么类型的格式.看起来不像 JSON

I have different php variables containing data that I want to put in one of the table in mysql database. The problem is I need to put the content in a specific format so another linked to the database can also use it. I don't know what type of format is this. It doesn't look like JSON

a:1:{i:0;s:27:"my@example.com";}



a:17:{i:0;a:7:{s:2:"id";s:1:"1";s:4:"slug";s:19:"contact-information";s:4:"name";s:19:"Contact Information";s:4:"type";s:8:"fieldset";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:1;a:7:{s:2:"id";s:1:"6";s:4:"slug";s:12:"company-name";s:4:"name";s:12:"Company Name";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:20:"Company Name is here";}i:2;a:7:{s:2:"id";s:1:"8";s:4:"slug";s:12:"contact-name";s:4:"name";s:12:"Contact Name";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:8:"Name";}i:3;a:7:{s:2:"id";s:2:"10";s:4:"slug";s:13:"email-address";s:4:"name";s:13:"Email Address";s:4:"type";s:5:"email";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:26:"example@gmail.com";}i:4;a:7:{s:2:"id";s:2:"12";s:4:"slug";s:15:"website-address";s:4:"name";s:15:"Website Address";s:4:"type";s:3:"url";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:25:"http://example.com";}i:5;a:7:{s:2:"id";s:2:"15";s:4:"slug";s:13:"contact-phone";s:4:"name";s:13:"Contact Phone";s:4:"type";s:5:"phone";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:12:"923246573632";}i:6;a:7:{s:2:"id";s:2:"16";s:4:"slug";s:12:"your-address";s:4:"name";s:12:"Your Address";s:4:"type";s:7:"address";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:91:"House # 2, Street 27<br>Chah Mrain<br>Lahore, Punjab 54000<br>New Zealand";}i:7;a:7:{s:2:"id";s:2:"27";s:4:"slug";s:19:"listing-information";s:4:"name";s:19:"Listing Information";s:4:"type";s:8:"fieldset";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:8;a:7:{s:2:"id";s:2:"17";s:4:"slug";s:13:"listing-title";s:4:"name";s:13:"Listing Title";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:17:"House of the Dead";}i:9;a:7:{s:2:"id";s:2:"19";s:4:"slug";s:12:"listing-type";s:4:"name";s:12:"Listing Type";s:4:"type";s:6:"select";s:7:"options";s:90:"a:4:{i:0;s:11:"Attractions";i:1;s:13:"Accommodation";i:2;s:5:"Tours";i:3;s:9:"Transport";}";s:9:"parent_id";s:1:"0";s:5:"value";s:13:"Accommodation";}i:10;a:7:{s:2:"id";s:2:"20";s:4:"slug";s:17:"listings-overview";s:4:"name";s:19:"Listing\'s Overview";s:4:"type";s:8:"textarea";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:55:"Here is the overview of listing lets check what happens";}i:11;a:7:{s:2:"id";s:2:"21";s:4:"slug";s:10:"logo-image";s:4:"name";s:10:"Logo Image";s:4:"type";s:11:"file-upload";s:7:"options";s:31:"a:1:{i:0;s:13:"png|jpe?g|gif";}";s:9:"parent_id";s:1:"0";s:5:"value";s:80:"http://example.com/connect-icon.png";}i:12;a:7:{s:2:"id";s:2:"25";s:4:"slug";s:9:"longitude";s:4:"name";s:9:"Longitude";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:13;a:7:{s:2:"id";s:2:"26";s:4:"slug";s:8:"latitude";s:4:"name";s:8:"Latitude";s:4:"type";s:4:"text";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:14;a:7:{s:2:"id";s:1:"2";s:4:"slug";s:12:"verification";s:4:"name";s:12:"Verification";s:4:"type";s:12:"verification";s:7:"options";s:0:"";s:9:"parent_id";s:1:"0";s:5:"value";s:0:"";}i:15;a:7:{s:2:"id";s:1:"3";s:4:"slug";s:27:"please-enter-any-two-digits";s:4:"name";s:27:"Please enter any two digits";s:4:"type";s:6:"secret";s:7:"options";s:0:"";s:9:"parent_id";s:1:"2";s:5:"value";s:2:"14";}i:16;a:7:{s:2:"id";s:1:"4";s:4:"slug";s:6:"submit";s:4:"name";s:6:"Submit";s:4:"type";s:6:"submit";s:7:"options";s:0:"";s:9:"parent_id";s:1:"2";s:5:"value";s:0:"";}}

我只想替换变量中的值并将其保存在数据库中.

I just want to replace the value that I have in the variables and save it in database.

推荐答案

该格式是 PHP 的 serialize() 函数.您可以使用 unserialize() 进行解码

That format is the result of PHP's serialize() function. You can use unserialize() to decode it.

这篇关于这是 json 以及如何用 php 变量替换值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆