Php 条件无法执行操作

Php 条件无法执行操作,php,Php,我提出以下条件,但不符合。条件无法执行操作。 解决办法是什么 if(empty($_FILES["img"]["name"])) 在空的宫殿中使用isset if(isset($_FILES["img"]["name"])) 试试这个 if ($_FILES['img']['size'] != 0 && $_FILES['img']['error'] == 0) { // imag is not empty (and not an error) } 发布你的表单和php代码

我提出以下条件,但不符合。条件无法执行操作。 解决办法是什么

if(empty($_FILES["img"]["name"]))

空的宫殿中使用
isset

if(isset($_FILES["img"]["name"]))
试试这个

if ($_FILES['img']['size'] != 0 && $_FILES['img']['error'] == 0)
{
// imag is not empty (and not an error)
}

发布你的表单和php代码,以便更好地理解你的问题!!哪些操作未执行?请提供源代码的其余部分,以便我们看到发生了什么?是否确定文件输入元素的名称?您的代码暗示您的文件输入元素类似于以下内容:。验证文件输入元素的name属性是否为img。你能证实这一点吗?