$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
PHP中文网2017-05-24 11:35:57
Solution:
class Input{
public function post($key){
if(isset($_POST[$key])){
$val=$_POST[$key];
return $val;
}
}
$input=new Input();
$upSet=$input->post("demo");
var_dump($upSet);
仅有的幸福2017-05-24 11:35:57
Write less closing curly braces below the Input class }
In addition, there are no parameters passed in the post method