我试图禁用一个特定的文件不存在时,通过添加“禁用”通过PHP的标记如果/其他。但我最终没有错误或任何一个空白页...这里是我的代码:PHP if语句禁用按钮
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
<?php if(file_exists('uploads/'.$results->id.'_.jpg')){
echo '';
}else{
echo 'disabled'; }
?>
>
如果我在同一个if语句,只是将其隐藏整个包住按钮,它工作得很好,但我想禁用它,而不是隐藏它。有什么东西会跳出来,因为错误?
什么'var_dump(file_exists('uploads /'.$ results-> id .'_。jpg'));'returns? – hsz
你不应该混合使用PHP和html – Dwza
@Dwza'不应该混合使用PHP和html'吗?这里有什么解决方法? –