深入extjs与php参数交互的详解

yipeiwu_com6年前PHP代码库
复制代码 代码如下:

<html>
 <head>
  <title>HelloWorld</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link rel="stylesheet" type="text/css" href="../../ext-4.0.7-gpl/resources/css/ext-all.css" >
  <script type="text/javascript" src="../../ext-4.0.7-gpl/bootstrap.js"></script>
  <script type="text/javascript" src="../../ext-4.0.7-gpl/locale/ext-lang-zh_CN.js"></script>
  <script type="text/javascript">
   Ext.onReady(function(){
    var requestConfig = {
     url:'loginServer.php', //请求的服务器地址
     params:{userName:'lowkey', password:'zq19890319'}, //请求参数
     method : "post",
     callback:function(options, success, response) {
         var msg=["请求是否成功:", success, "\n",
           "服务器返回值:", response.responseText];
         Ext.Msg.alert("提示", response.responseText);
        }
    }
    Ext.Ajax.request(requestConfig);
   });

  </script>
 </head>

 <body>
 </body>
</html>

复制代码 代码如下:

<?php
 $userName = $_POST["userName"];
 $password = $_POST["password"];
 $msg = "";
 if($userName=="lowkey" && $password=="zq19890319") {
  $msg = "登陆成功";
 } else {
 $msg = "登陆失败";
 }
 echo($msg);
?>

相关文章

php基于协程实现异步的方法分析

本文实例讲述了php基于协程实现异步的方法。分享给大家供大家参考,具体如下: github上php的协程大部分是根据这篇文章实现的:http://nikic.github.io/2012...

Window下PHP三种运行方式图文详解

Window下PHP三种运行方式图文详解

PHP能不能成功的在Apache服务器上运行,就看我们如何去配置PHP的运行方式。PHP运行目前为止主要有三种方式: a、以模块加载的方式运行,初学者可能不容易理解,其实就是将PHP集成...

Linux下php5.4启动脚本

Linux下php5.4启动脚本

废话不多说,直接上步骤 1、修改php-fpm.conf配置文件 修改/usr/local/php/etc/php-fpm.conf(当然这个跟你配置的php路径相关)配置文件 启动pi...

setcookie中Cannot modify header information-headers already sent by错误的解决方法详解

复制代码 代码如下:<?php   setcookie("username","bu",time()+3600);   echo "aaaa...

php curl上传、下载、https登陆实现代码

1、curl下载 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "ftp://127.0.0.1/downtest.txt");...