Home  >  Article  >  Backend Development  >  php post提交。有关问题

php post提交。有关问题

WBOY
WBOYOriginal
2016-06-13 13:35:02784browse

php post提交。问题
假如post提交:
user=name1&password1=123456&password2=123456
这样的连接 

我想name{num}  
num{}=1,2,3,4,5,6等等

这里的变量怎么写?
源码如下:

PHP code


Response header:\n";   
echo $headers;   
echo "\n";   
   
echo "

Response body:

\n"; echo $body; ?>


------解决方案--------------------
3楼被删??
写个文件初始内容为1,post之前读取文件取出数值$num,得到name.$num,post之后把$num加1再写入这个文件
------解决方案--------------------
//post之前
$filenum="num.txt";
$fnum=fopen($filenum,"r");
if(!$num=fgetc($fnum))
{$num=0;}
.......你的操作
//post之后
$filenum="num.txt";
$fnum=fopen($filenum,"r");
if(!$num=fgetc($fnum))
{$num=0;}
else
{$num=intval($num)++;
fclose($fnum);
$fnumw=fopen($filenum,"w");
fwrite(fnumw,strval($num));
fclose($filenum);
}
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn