<?php
$sum = 12;//小宠物当前的饥饿程度
echo "我饿啦:-(";
echo "<br />";
$max =0; //初始次数
while($sum<100){
$num = rand(1,20);//随机数,模拟喂食小宠物的小面包
$sum = $sum + $num; //小宠物吃小面包
$max = $max+1;
echo "我还没吃饱呢!";
echo "本次饥饿程度恢复到:".$sum."";
echo "<br />";
}
echo "终于吃饱啦^_^";
echo "一共喂了".$max."次!";
?>
$sum = 12;//小宠物当前的饥饿程度
echo "我饿啦:-(";
echo "<br />";
$max =0; //初始次数
while($sum<100){
$num = rand(1,20);//随机数,模拟喂食小宠物的小面包
$sum = $sum + $num; //小宠物吃小面包
$max = $max+1;
echo "我还没吃饱呢!";
echo "本次饥饿程度恢复到:".$sum."";
echo "<br />";
}
echo "终于吃饱啦^_^";
echo "一共喂了".$max."次!";
?>
2019-03-14
建议大家加入以下两段代码,再看看效果:
$num = rand(1,50);//获取1至50的随机数
echo $num ;
echo "<br />";
$info = "";//提示信息
$num = rand(1,50);//获取1至50的随机数
echo $num ;
echo "<br />";
$info = "";//提示信息
2019-03-13
修改httpd.conf文件,允许所有主机访问。
# onlineoffline tag - don't remove
Require local
把Require local替换成Require all granted,重启服务器。
注意:
Require local 仅允许本地访问;
Require all denied 拒绝所有访问;
Require all granted 允许所有访问;
Require ip 192.168.0.1 仅允许IP:192.168.0.1 访问;
Require not ip 192.168.0.1 仅禁止IP:192.168.0.1访问;
# onlineoffline tag - don't remove
Require local
把Require local替换成Require all granted,重启服务器。
注意:
Require local 仅允许本地访问;
Require all denied 拒绝所有访问;
Require all granted 允许所有访问;
Require ip 192.168.0.1 仅允许IP:192.168.0.1 访问;
Require not ip 192.168.0.1 仅禁止IP:192.168.0.1访问;
2019-03-07