Home >Backend Development >PHP Tutorial >请教获取的GET如何判断是否为纯数字

请教获取的GET如何判断是否为纯数字

WBOY
WBOYOriginal
2016-06-13 10:09:321405browse

请问获取的GET怎么判断是否为纯数字
你好。请问获取的GET怎么判断是否为纯数字,假如GET的值不是纯数字“不含有数字”,否则显示“成功”。谢谢。求PHP代码,谢谢!

------解决方案--------------------

PHP code
if(isset($_GET['id'])){  if(is_numeric($_GET['id']))    echo '成功';  else    echo '不是纯数字';}<br><font color="#e78608">------解决方案--------------------</font><br>
探讨

引用:

设url为 http://localhost/index.php?id=123



if(is_numeric($_GET['id']))
echo '是纯数字';
else
echo '不是是纯数字';





想问下,为什么不加{和}的?
例如
if(isset($_GET['shi']))
{
if……
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn