返回小案例:判断输......登陆

小案例:判断输入的字符串是不是PHP的关键字(key.php)

奔跑2019-03-26 11:09:10296
<?php
$get = isset($_GET['in']) ? $_GET['in'] : '';

$key = '__halt_compiler() abstract and array() as break callable case catch class clone const continue declare default die() do echo else elseif empty() enddeclare endfor endforeach endif endswitch endwhile eval() exit() extends final finally for foreach function global goto if implements include include_once instanceof insteadof interface isset() list() namespace new or print private protected public require require_once return static switch throw trait try unset() use var while xor yield';

$get = trim($get);
?>

<div>
<span style="color:red;">输入PHP关键字:</span>
<form action="key.php" method='GET'>
<input type="text" name="in" id="">
<button style='color:red;'>提交</button>
</form>

</div>

<?php
if (!empty($get)) {
$get = strtolower($get);
if (strpos($key, $get)) {
echo "<span style='color:red;'>'{$get}' 是一个PHP关键字!</span>";
} else {
echo "<span style='color:red;'>输入错误,  '{$get}'  不是一个PHP关键字</span>";
}
}

?>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送