Check if a variable is empty

前端 未结 4 1561
南旧
南旧 2020-12-11 13:10

I have some user-submitted variables that I want to display in a different part of my site like this:

Term:
4条回答
  •  鱼传尺愫
    2020-12-11 13:53

    Well they way your code is above, $key will never be empty, thus the pre_box will always be displayed. You're setting $key = 'term', which gives it a value so !empty($key) or isset($key) will always be true.

    Casey's solution should give you the result you're going for.

提交回复
热议问题