我想在数组中使用变量字符串,如我保存的数组值,任何文件或文档或变量,我想在数组中使用它,但我没有这样做。在数组中使用变量字符串php
$var = "'title' => 'This is my title','name' => 'My name is John'";
$ar = array($var);
echo $ar['title'].'<br>'.$ar['name'];
错误我得到
Notice: Undefined index: title
Notice: Undefined index: name
看一看这个所以问题,也许它有助于你想要存档:http://stackoverflow.com/questions/11267434/php-how-to-turn-a-string-that-contains-an-array-expression-in-an - 实际数组 – Bjoern 2015-02-07 09:25:41