"1988","李四"=>"1990","王五"=>"1989")';fo">
时间:2021-07-01 10:21:17 帮助过:5人阅读
$arr是字符串类型,单引号中是数组语法,如何将该字符串转换为数组类型?
$arr = 'array("张三"=>"1988","李四"=>"1990","王五"=>"1989")';foreach($arr as $key => $value){ echo "姓名:".$key."-年份:".$value."
";}
字符串里的数据格式不对,你那个是以键值对的形式保存,而且还是字符串型的,矛盾了;