php结合表单实现一些简单功能的例子
程序员文章站
2022-06-12 14:39:00
...
例子一(POST提交表单):
Chunkify Form
Chunkify Word
$word=$_POST["word"];
$number=$_POST["number"];
$chunks=ceil(strlen($word)/$number);
echo "The $number-letter chunks of "$word" are:
\n";
for ($i = 0;$i$chunk=substr($word,$i*$number,$number);
printf("%d: %s
\n",$i+1,$chunk);
}
?>
复制代码 代码如下:
Chunkify Form
复制代码 代码如下:
Chunkify Word
$word=$_POST["word"];
$number=$_POST["number"];
$chunks=ceil(strlen($word)/$number);
echo "The $number-letter chunks of "$word" are:
\n";
for ($i = 0;$i$chunk=substr($word,$i*$number,$number);
printf("%d: %s
\n",$i+1,$chunk);
}
?>