Home > Backend Development > PHP Tutorial > 递归验证用户输入有关问题

递归验证用户输入有关问题

WBOY
Release: 2016-06-13 12:48:06
Original
786 people have browsed it

递归验证用户输入问题

<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);
Copy after login

请问,如果第一次输入成功,通过验证,那return $canshu;没问题;但请问在递归里,我怎么得到最后输入成功的值?谢谢了


------解决方案--------------------
不是 return checkenter($canagin); 么?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template