php使用eval函数将字符串形式的数组转化为真数组

// 字符串的数组
$arr="array ('tupian' => array ( 'tupian' => '/pub/upfiles/image/201804/20180419111658_68798.jpg', 'miaoshu' => '', 'lianjie' => 'http://', ),)";
// 利用此函数转化为数组
print_r(eval("return $arr;"));die;
Array
(
    [tupian] => Array
        (
            [tupian] => /pub/upfiles/image/201804/20180419111658_68798.jpg
            [miaoshu] => 
            [lianjie] => http://
        )

)

原文链接:
https://www.jianshu.com/p/e1646d3ac7a1

你可能感兴趣的:(PHP)