此字符串的类型是什么? a:1:{s:2:"en";} [英] What is the type this string? a:1:{s:2:"en";}

查看:88
本文介绍了此字符串的类型是什么? a:1:{s:2:"en";}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

a:1:{s:2:"en";s:39:"Sample Text";}

简短的我的问题是,您对上述格式有想法吗?

Shortly my question, do you have an idea about the above format?

我想按照上述类似JSON之类的格式存储长站点设置.

I want to store long site settings following array like above format like JSON.

$settings = array(
            'slug' => 'test',
            'title' => 'John Doe',
            'description' => 'A Yes or No option for the module',
            '`default`' => '1',
            '`value`' => '1',
            'type' => 'select',
            '`options`' => '1=Yes|0=No',
            'is_required' => 1,
            'is_gui' => 1,
            'module' => 'johndoe'
        );

它看起来像JSON,但可能不是.

It look likes JSON but probably it's not.

我对这种格式的读取和创建一无所知.

I have not any idea about this format reading and creating.

实际上使用哪种PHP和MySQL数据类型来存储具有最佳性能的长参数?

In fact which PHP and MySQL Datatype to use for storing long params with best performance?

推荐答案

您在此处显示的数据类型是PHP中的序列化变量.

The datatype you're showing us here is a serialized variable in PHP.

要序列化或反序列化,只需使用以下两种方法:

To serialize or unserialize it, just use these two methods :

http://php.net/manual/en/function.serialize.php

http://www.php.net/manual/zh/function. unserialize.php

要将其存储在MySQL中,取决于序列化数据的大小.可以使用VARCHAR,TINYTEXT,TEXT,MEDIUMTEXT或BIGTEXT.

To store it in MySQL, depends on the size of the serialized data. VARCHAR, TINYTEXT, TEXT, MEDIUMTEXT or BIGTEXT are available.

这篇关于此字符串的类型是什么? a:1:{s:2:"en";}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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