首页 > phper

php ajax返回 json数据实例

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>php教程 ajax返回 网页特效on数据实例</title>
<script type="text/网页特效" language="javascript">
var xmlhttp;
function createxmlhttprequest()
{
//var xmlhttp=null;
try
  {
  // firefox, opera 8.0+, safari
  xmlhttp=new xmlhttprequest();
  }
catch (e)
  {
  // internet explorer
  try
    {
    xmlhttp=new activexobject("msxml2.xmlhttp");
    }
  catch (e)
    {
    xmlhttp=new activexobject("microsoft.xmlhttp");
    }
  }
return xmlhttp;
}
function startrequest(id)
{
    createxmlhttprequest();
    try
    {  
     url="json.php?cid="+id;
        xmlhttp.onreadystatechange = handlestatechange;
        xmlhttp.open("post", url, true);
        xmlhttp.send(null);
    }
    catch(exception)
    {
        alert("xmlhttp fail");
    }
}
function handlestatechange()
{
    if(xmlhttp.readystate == 4)
    {
        if (xmlhttp.status == 200 || xmlhttp.status == 0)
        {
            var result = xmlhttp.responsetext;
            var json = eval("(" + result + ")");
            alert('name:'+json.name);
            alert('age:'+json.age);
   alert('id:'+json.id);
        }
    }
}
</script>
</head>

阅读全文

php将第三方应用会员表导入到ucenter memberfields表

 

mysql教程_connect('localhost','0731-cn','0731licheng1') or die('sever ');
 mysql_select_db('0731-cn') or die('database error');
 $sql = "select uid from member ";
 $query = mysql_query( $sql ) or die('ddd');
 while( $row = mysql_fetch_array( $query ) )
 {
  mysql_query("insert into uc_memberfields(uid,username,password,email,myid,myidkey,regip,regdate,lastloginip,lastlogintime  salt,secques) values('".$row['uid']."','".$row['uid']."')") or die('jjjjj'.mysql_error());

阅读全文

php提取文章内容图片地址正则表达式

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>php教程提取文章内容图片地址正则表达式</title>
</head>

阅读全文

ajax+php验证用户名重复代码实例

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.phprm.com/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>ajax+php验证用户名重复代码实例</title>

阅读全文

php 连接 mysql数据库操作类

class mysql{

  private $db_host; //数据库主机
  private $db_user; //数据库用户名
  private $db_pwd; //数据库密码
  private $db_database; //数据库名
  private $conn; //数据库连接标识;
  private $sql; //sql执行的语句
  private $result; //query的资源标识符
  private $coding; //数据库编码,gbk,utf8,gb2312
  private $show_error = true; //本地调试使用,打印错误

阅读全文

php注册页面代码(mysql+php)

 include('global.php');

 if($_post['sub']){
  $user  = $_post['username'];
  $pwd   = md5($_post['password1'].$user);
  $email = $_post['email'];
   $q = $mysql->query("insert into `hl`.`hl_member`(`id`,`username`,`password`,`email`)values (null,'$user','$pwd','$email');");
  if($q){
   setcookie('login',$user);
   $prompt_msg->p('恭喜您,亲爱的会员,您已经注册成功!','index.php','现在去首页。','http://www.phprm.com','先去论坛逛逛!');
  }else{
   $prompt_msg->p('非常抱歉,系统发生故障!');
  }
 }
?>

阅读全文

数组转换字符串php代码

本文章是一个实例,功能是数组转换字符串php代码哦,他能把一维数组,二维数组都转换成字符串代码。  代码如下 复制代码 <?php$fruits = array ("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),"numbers" => array(1...
阅读全文