📌  相关文章
📜  laravel 复选框已选中 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:29.705000             🧑  作者: Mango

代码示例1
//You should write a value in the checkbox and then check if that value is null or not:

//HTML, in form:


//PHP, in controller:
$isChecked = $request->check != null;

//If the checkbox is checked, then the $request->check will not be null. Otherwise, it will.
//Then the $isChecked variable will be true if the checkbox is checked, and false if it isn't.