mysql - a library for PHP, please give me more information.

WBOY
Release: 2016-09-08 08:44:02
Original
974 people have browsed it

I often work behind closed doors and know very little about other things in PHP.
Today when I was studying Typeche, I encountered something similar:

<code>a:2:{s:7:"logoUrl";N;s:12:"sidebarBlock";a:5:{i:0;s:15:"ShowRecentPosts";i:1;s:18:"ShowRecentComments";i:2;s:12:"ShowCategory";i:3;s:11:"ShowArchive";i:4;s:9:"ShowOther";}}</code>
Copy after login
Copy after login
<code><?php exit;//a:4:{i:4;a:1:{i:0;a:3:{s:6:"tagurl";s:18:"%E4%B8%8D%E7%9D%A1";s:7:"tagname";s:6:"不睡";s:3:"tid";i:2;}}i:3;a:1:{i:0;a:3:{s:6:"tagurl";s:18:"%E6%B0%B4%E6%B0%B4";s:7:"tagname";s:6:"水水";s:3:"tid";i:1;}}i:2;a:0:{}i:1;a:0:{}}</code>
Copy after login
Copy after login

The database configuration, I want to know the relevant information about the configuration of this format. Baidu is not as good as Baidu. I can’t find the tracking code today. Please give me some advice.

Reply content:

I often work behind closed doors and know very little about other things in PHP.
Today when I was studying Typeche, I encountered something similar:

<code>a:2:{s:7:"logoUrl";N;s:12:"sidebarBlock";a:5:{i:0;s:15:"ShowRecentPosts";i:1;s:18:"ShowRecentComments";i:2;s:12:"ShowCategory";i:3;s:11:"ShowArchive";i:4;s:9:"ShowOther";}}</code>
Copy after login
Copy after login
<code><?php exit;//a:4:{i:4;a:1:{i:0;a:3:{s:6:"tagurl";s:18:"%E4%B8%8D%E7%9D%A1";s:7:"tagname";s:6:"不睡";s:3:"tid";i:2;}}i:3;a:1:{i:0;a:3:{s:6:"tagurl";s:18:"%E6%B0%B4%E6%B0%B4";s:7:"tagname";s:6:"水水";s:3:"tid";i:1;}}i:2;a:0:{}i:1;a:0:{}}</code>
Copy after login
Copy after login

The database configuration, I want to know the relevant information about the configuration of this format. Baidu is not as good as Baidu. I can’t find the tracking code today. Please give me some advice.

The result of php serialization
This string can be converted into a php variable through unserialize.

Today I am trying to find out what generated the storage file in the following format:

<code>a:4:{i:4;a:1:{i:0;a:3:{s:6:"tagurl";s:18:"%E4%B8%8D%E7%9D%A1";s:7:"tagname";s:6:"不睡";s:3:"tid";i:2;}}i:3;a:1:{i:0;a:3:{s:6:"tagurl";s:18:"%E6%B0%B4%E6%B0%B4";s:7:"tagname";s:6:"水水";s:3:"tid";i:1;}}i:2;a:0:{}i:1;a:0:{}}</code>
Copy after login

My mother is mentally retarded. I first searched for it in Typecho for 3 hours and tried my best but still couldn’t find it. . . . . .
What makes me vomit blood is that I think that the cache of Emlog, a PHP program, is in this format. I followed MDZZ and saw the code:

<code class="php">$cacheData = serialize($tag_cache);
$this->cacheWrite($cacheData, 'tags');</code>
Copy after login

Everything comes to light, MDZZ. . . . It took me 3 hours, what a fucking waste of time!

<code class="php">    function MDZZ()
    {
        $array=['name'=>'DXKite','type'=>'智障'];
        $str=serialize($array);
        var_dump($str);
        var_dump(unserialize($str));
    }</code>
Copy after login

Output:

<code>string(54) "a:2:{s:4:"name";s:6:"DXKite";s:4:"type";s:6:"智障";}" array(2) { ["name"]=> string(6) "DXKite" ["type"]=> string(6) "智障" }</code>
Copy after login

In PHP language, if you want to save the array content directly to the database, serialize is often used. However, serialize often produces some inexplicable errors. The encoding efficiency of encode is not as good as json_encode, and the amount of generated code is more than json_encode.
It is recommended to use json_encode.

Serialize is often used for caching

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template