Heim >Backend-Entwicklung >PHP-Tutorial > 递归验证用户输入有关问题
递归验证用户输入问题
<br /> function checkenter($canshu){<br /> //验证输入<br /> $obj = new base($canshu);<br /> $re1 = $obj->list_tables($canshu);<br /> <br /> //如果验证不通过<br /> if($re1 === false){<br /> echo "The '$canshu' was not found, Please input again \n";<br /> //再次要求输入<br /> $canagin = enter();<br /> //递归验证<br /> checkenter($canagin);<br /> }<br /> return $canshu;<br /> <br /> }<br /> $result = checkenter($canshu);<br /> var_dump( $result);