isset PHP isset($_GET['something']) ? $_GET['something'] : ''

前端 未结 8 1449
清酒与你
清酒与你 2020-12-13 04:02

I am looking to expand on my PHP knowledge, and I came across something I am not sure what it is or how to even search for it. I am looking at php.net isset code, and I see

8条回答
  •  盖世英雄少女心
    2020-12-13 04:41

    What you're looking at is called a Ternary Operator, and you can find the PHP implementation here. It's an if else statement.

    if (isset($_GET['something']) == true) {
        thing = isset($_GET['something']);
    } else {
        thing = "";
    }
    

提交回复
热议问题