第一步需要一个 jq的js文件
Login这是页面文件
下面是 php文件 一个方法
/**
* 登陆方法
* **/
function loginAction(){
if(strtolower($_SERVER['REQUEST_METHOD']) == 'post'){
//$name = $this->_request->getpost("uname");
$name = $this->getRequest()-> getQuery("uname");
//$pws = $this->_request->getpost("upas");
$pws = $this->getRequest()-> getQuery("upas");
$userTable = new Username();
$where = "name = '".$name."' and paws = '".$pws."' ";
$result_all = $userTable -> fetchAll($where) -> toArray();
if(count($result_all) > 0){
$this->_helper->getHelper('Json')-> sendJson(1);
$SetSession = new Zend_Session_Namespace('setusersession');//存储session
$SetSession -> sname = $name;
$SetSession -> spws = $pws;
echo $this -> view -> render('bluser.phtml');
}else{
$this->_helper->getHelper('Json')-> sendJson(2);
}
}else{
echo $this -> view -> render('login.phtml');
}
}