Heim  >  Artikel  >  Backend-Entwicklung  >  php数组保存文本与文本反编成数组_PHP教程

php数组保存文本与文本反编成数组_PHP教程

WBOY
WBOYOriginal
2016-07-13 17:00:19845Durchsuche

本文章来给各位同学介绍php数组保存文本与文本反编成数组方法,有需要了解的同学可进入参考。

实例

 

 代码如下 复制代码

function string2array($data) { 
if($data == '') return array();
 @eval("$array = $data;"); return $array;

}

/** 将数组转换为字符串

 代码如下 复制代码

* @param    array   $data       数组
* @param    bool    $isformdata 如果为0,则不使用new_stripslashes处理,可选参数,默认为1
* string  返回字符串,如果,data为空,则返回空  */

function array2string($data, $isformdata = 1) {
 if($data == '') return '';
 if($isformdata) $data = new_stripslashes($data);
 return addslashes(var_export($data, TRUE));
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/631259.htmlTechArticle本文章来给各位同学介绍php数组保存文本与文本反编成数组方法,有需要了解的同学可进入参考。 实例 代码如下 复制代码 function string2ar...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn