我有两个文件,b.txt:
&first = cjnk1
&second = dcnksj2
&third = cd3
&fourth = cdln4
和一个.php:
<?php
$data=file_get_contents("b.txt");
$rows=explode("\n", $data);
foreach($rows as $row)
{
$temp=explode(" = ",$row);
$info[ltrim($temp[0],"&")]=$temp[1];
}
echo '<pre>';
print_r($info);
echo $info["&first"];
?>
输出是
Array
(
[&first] => cjnk1
[second] => dcnksj2
[third] => cd3
[fourth] => cdln4
)
第一个索引有什么问题?即使我使用它,它也无法回声..