我想读一个格式化的文件PHP读取文件
name
(读取到这个变量)
10 10
(读成独立的变量)
,其余为阵列
line
line
line
line
来澄清这是一个上传脚本,我已经完成了,当用户上传一个格式化的文件时,它以上述方式读取它
$fname = 'test.txt';
$lines = file("$fname", "r");
while($lines as $currenline){
I am trying to put the name, width, height into variables
then the rest into the array
}
将这种帮助
如果你使用'array_shift($线)'代替'$行[0]'和'$线[1]',你可以摆脱'array_slice()'的。 – 2010-11-06 15:43:34
您还使用array_shift操作数组3次而不是一次。 – smack0007 2010-11-06 15:45:28
@ smack0007 - 我正在访问数组两次,并操纵它一次,而不是操纵它3次... – 2010-11-06 15:46:34