简单的PHP isset测试 [英] Simple PHP isset test

查看:82
本文介绍了简单的PHP isset测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面这似乎不符合我的预期,尽管$ _GET ['friendid'] = 55却返回NULL

This below does not seem to work how I would expect it, event though $_GET['friendid'] = 55 it is returning NULL

<?PHP

$_GET['friendid'] = 55;

$friendid = (!isset($_GET['friendid'])) ? $_GET['friendid'] : 'empty';

echo $friendid;
exit;

?>

推荐答案

删除!.您不想否定表达式.

Remove the !. You don't want to negate the expression.

$friendid = isset($_GET['friendid']) ? $_GET['friendid'] : 'empty';

这篇关于简单的PHP isset测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆