PHP求一等式,由于本人比较菜。 $arr = array(4,7,0,2,4,5,6,9,1,2,3); //这是原来的 我想$_POST[qq](表单传递的值等于上面的样式)$arr = explode(',',$_POST['qq']); 这样写有问题。。请指点一下谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 首先楼主没必要开3个一样的帖子吧第二楼主没把问题讲情况,至少我不是非常理解第三,我只能大概了解一下了,是说接收过来的数据$_POST[qq]=array(4,7,0,2,4,5,6,9,1,2,3); 还是说接收过来的$_POST[qq]=4,7,0,2,4,5,6,9,1,2,3 是有表单的。。<form name="form1" method="post" action=""><input type="text" name="qq" /><input type="submit" name="Submit" value="提交" /></form><?phpecho $_POST[qq];echo '<br>';//以上内容为后加的//想让上面的$_POST[qq]传递或是赋值给$arr//$arr = array(4,7,0,2,4,5,6,9,1,2,3,4,5,6,8,0); //原来的$arr = explode(',',$_POST['qq']); $arrPrice = array(3 => 30, 4 => 34, 5 => 42, 6 => 52, 7 => 62); //分值设置$counter =$counterMax = 1; //连续的for($i = 0; $i < count($arr) - 1; $i ++) { if ($arr[$i + 1] == $arr[$i] + 1) { $counter ++; if ($counter > $counterMax) $counterMax ++; } else $counter = 1;}if ($counterMax >= 4) echo "检测到{$counterMax}位连续数字,得分为{$arrPrice[$counterMax]}分";?> 这个,你是hackjjj的马甲吧,这是最后一次回答你的问题了。获取表单参数也写错了!//直接操作字符串就可以了$str = $_POST['qq'];$arrPrice = array(3 => 30, 4 => 34, 5 => 42, 6 => 52, 7 => 62); //分值设置$counter =$counterMax = 1; //连续的for($i = 0; $i < strlen($str) - 1; $i ++) { if ($str[$i + 1] == $str[$i] + 1) { $counter ++; if ($counter > $counterMax) $counterMax ++; } else $counter = 1;}if ($counterMax >= 4) echo "检测到{$counterMax}位连续数字,得分为{$arrPrice[$counterMax]}分"; 呵呵哪个账号没积分了。不能提问了。。不过这个什么也没有显示<form name="form1" method="post" action=""><input type="text" name="qq" /><input type="submit" name="Submit" value="提交" /></form><?php$str = $_POST['qq'];$arrPrice = array(3 => 30, 4 => 34, 5 => 42, 6 => 52, 7 => 62); //分值设置$counter =$counterMax = 1; //连续的for($i = 0; $i < strlen($str) - 1; $i ++) { if ($str[$i + 1] == $str[$i] + 1) { $counter ++; if ($counter > $counterMax) $counterMax ++; } else $counter = 1;}if ($counterMax >= 4) echo "检测到{$counterMax}位连续数字,得分为{$arrPrice[$counterMax]}分";?> 如何去掉action-model-name? cakephp的框架搭建的例子 PHP工作问题。 php通过$_REQUEST向COM接口传递值,服务端接收出现乱码原因 重开一贴,解决 WordPress路径问题 求用PHP做的文章管理系统项目 asp转php问题 网页上出现这几行代码 求翻译一下 ckeditor for php 怎以没有了?官网没下载了!!!!只有纯JS版的!!! ecshop手机访问自己添加的页面会自动跳转到/mobile目录下 PHP求一等式,由于本人比较菜。 各位大虾请进:有没有让Smarty跟DreamWeaver协同工作的插件?
是有表单的。。
<form name="form1" method="post" action="">
<input type="text" name="qq" />
<input type="submit" name="Submit" value="提交" />
</form><?php
echo $_POST[qq];
echo '<br>';
//以上内容为后加的//想让上面的$_POST[qq]传递或是赋值给$arr
//$arr = array(4,7,0,2,4,5,6,9,1,2,3,4,5,6,8,0); //原来的
$arr = explode(',',$_POST['qq']); $arrPrice = array(3 => 30, 4 => 34, 5 => 42, 6 => 52, 7 => 62); //分值设置
$counter =$counterMax = 1; //连续的
for($i = 0; $i < count($arr) - 1; $i ++) {
if ($arr[$i + 1] == $arr[$i] + 1) {
$counter ++;
if ($counter > $counterMax) $counterMax ++;
}
else $counter = 1;
}
if ($counterMax >= 4) echo "检测到{$counterMax}位连续数字,得分为{$arrPrice[$counterMax]}分";
?>
获取表单参数也写错了!
//直接操作字符串就可以了
$str = $_POST['qq'];
$arrPrice = array(3 => 30, 4 => 34, 5 => 42, 6 => 52, 7 => 62); //分值设置
$counter =$counterMax = 1; //连续的
for($i = 0; $i < strlen($str) - 1; $i ++) {
if ($str[$i + 1] == $str[$i] + 1) {
$counter ++;
if ($counter > $counterMax) $counterMax ++;
}
else $counter = 1;
}
if ($counterMax >= 4) echo "检测到{$counterMax}位连续数字,得分为{$arrPrice[$counterMax]}分";
不过这个什么也没有显示
<form name="form1" method="post" action="">
<input type="text" name="qq" />
<input type="submit" name="Submit" value="提交" />
</form><?php
$str = $_POST['qq'];
$arrPrice = array(3 => 30, 4 => 34, 5 => 42, 6 => 52, 7 => 62); //分值设置
$counter =$counterMax = 1; //连续的
for($i = 0; $i < strlen($str) - 1; $i ++) {
if ($str[$i + 1] == $str[$i] + 1) {
$counter ++;
if ($counter > $counterMax) $counterMax ++;
}
else $counter = 1;
}
if ($counterMax >= 4) echo "检测到{$counterMax}位连续数字,得分为{$arrPrice[$counterMax]}分";
?>