$input=new Input();
$upSet=$input->post();
var_dump($upSet);
class Input{
function post($key){
if(isset($_POST[$key])){
$val=$_POST[$key];
return $val;
}
}
报错
Warning: Missing argument 1 for Input::post(),
Notice: Undefined variable: key
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
解决:
function post($key = 'default'){}
Input类下面少写个闭合的花括号 }
另外post方法里没有传参