分享一个PHP数据流应用的简单例子
程序员文章站
2023-11-12 20:59:16
复制代码 代码如下:
<?php
$count = 5;
start:
if($count < 5) echo "you can try {$count} time, ";
echo "put password: ";
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
if(trim($line) != '123456'){
$count--;
if(!$count) goto error;
goto start;
}
goto success;
error:
echo "please try after 1 hour! //www.jb51.net";
goto out;
success:
echo "logined!";
out:
?>
效果图:
复制代码 代码如下:
<?php
$count = 5;
start:
if($count < 5) echo "you can try {$count} time, ";
echo "put password: ";
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
if(trim($line) != '123456'){
$count--;
if(!$count) goto error;
goto start;
}
goto success;
error:
echo "please try after 1 hour! //www.jb51.net";
goto out;
success:
echo "logined!";
out:
?>
效果图: