isset vs empty vs is_null

后端 未结 14 2146
野的像风
野的像风 2020-11-29 08:34

I\'m trying to write a script that when a user uploads a file and does not enter a name an error is returned. I\'ve tried using is_null, empty, and isset and they all do not

14条回答
  •  渐次进展
    2020-11-29 08:53

    I think you meant to use isset before you assigned it to something:

    if(!isset($_REQUEST[$name_input_name]))
    {
        $file->error = 'Please Enter a Title';
        return false;
    }
    
    $caption = $_REQUEST[$name_input_name];
    

提交回复
热议问题