社区
PHP
帖子详情
求php代码例子
林g
2009-05-20 11:16:04
谁能给我一个php代码ajax的例子,我现在想学习php,是web方面
请大家帮忙提供点示例
谢谢了!
...全文
165
7
打赏
收藏
求php代码例子
谁能给我一个php代码ajax的例子,我现在想学习php,是web方面 请大家帮忙提供点示例 谢谢了!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lzz0098
2009-05-22
打赏
举报
回复
http://download.csdn.net/source/1329125
这里有一些Ajax入门知识
yybjroam05
2009-05-21
打赏
举报
回复
http://hi.baidu.com/jroam/blog/item/0df478f4087778daf3d385c1.html 给个网址你可以参考一下!
晒月光的青蛙
2009-05-21
打赏
举报
回复
ls的代码可以,初学的话看书还快点
林g
2009-05-21
打赏
举报
回复
本人是初学php,发这贴是为了帮人找资料.
请大家多多发言
sun0298
2009-05-21
打赏
举报
回复
路过帮你踩踩
wang_quan_li
2009-05-20
打赏
举报
回复
ajaxreg.js代码如下:
var http_request=false;
function send_request(url){//初始化,指定处理函数,发送请求的函数
http_request=false;
//开始初始化XMLHttpRequest对象
if(window.XMLHttpRequest){//Mozilla浏览器
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){//设置MIME类别
http_request.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject){//IE浏览器
try{
http_request=new ActiveXObject("Msxml2.XMLHttp");
}catch(e){
try{
http_request=new ActiveXobject("Microsoft.XMLHttp");
}catch(e){}
}
}
if(!http_request){//异常,创建对象实例失败
window.alert("创建XMLHttp对象失败!");
return false;
}
http_request.onreadystatechange=processrequest;
//确定发送请求方式,URL,及是否同步执行下段代码
http_request.open("GET",url,true);
http_request.send(null);
}
//处理返回信息的函数
function processrequest(){
var mess
if(http_request.readyState==4){//判断对象状态
if(http_request.status==200){//信息已成功返回,开始处理信息
if(http_request.responseText=='exist')
mess="<font color=red>此用户名已经存在,请更换用户名!</font>";
else if(http_request.responseText=='ok')
mess="<font color=red>此用户名可以注册</font>";
else if(http_request.responseText=='right')
mess="<font color=red>旧密码正确</font>";
else if(http_request.responseText=='error')
mess="<font color=red>旧密码不正确</font>";
document.getElementById(reobj).innerHTML=mess;
}
else{//页面不正常
alert("您所请求的页面不正常!");
}
}
}
function usercheck(obj){
var f=document.reg;
var username=f.username.value;
if(username==""){
document.getElementById(obj).innerHTML=" <font color='#ff0000'>用户名不能为空!</font>";
//f.username.focus();
//return false;
}
else if(username.replace(/[^\x00-\xff]/g,'##').length>16){
document.getElementById(obj).innerHTML=" <font color=red>用户名长度不能大于16位(汉字不能超过8个)!</font>";
//f.userpwd.focus();
return false;
}
else{
document.getElementById(obj).innerHTML="正在读取数据...";
send_request('checkuserreg.php?username='+username);
reobj=obj;
}
}
function userpwdcheck(obj){
var f=document.reg;
var oldpassword=f.oldpassword.value;
if(oldpassword==""){
document.getElementById(obj).innerHTML=" <font color='#ff0000'>旧密码不能为空!</font>";
//f.username.focus();
//return false;
}
else{
document.getElementById(obj).innerHTML="正在读取数据...";
send_request('checkuserpwd.php?oldpassword='+oldpassword);
reobj=obj;
}
}
function pwdcheck(obj){
var f=document.reg;
var pwd=f.userpwd.value;
if(pwd==""){
document.getElementById(obj).innerHTML=" <font color=red>用户密码不能为空!</font>";
//f.userpwd.focus();
return false;
}
else if(f.userpwd.value.length<6){
document.getElementById(obj).innerHTML=" <font color=red>密码长度不能小于6位!</font>";
//f.userpwd.focus();
return false;
}
else{
document.getElementById(obj).innerHTML=" <font color=red>密码符合要求!</font>";
}
}
function pwdrecheck(obj){
var f=document.reg;
var repwd=f.reuserpwd.value;
if (repwd==""){
document.getElementById(obj).innerHTML=" <font color=red>请再输入一次密码!</font>";
//f.reuserpwd.focus();
return false;
}
else if(f.userpwd.value!=f.reuserpwd.value){
document.getElementById(obj).innerHTML=" <font color=red>两次输入的密码不一致!</font>";
//f.reuserpwd.focus();
return false;
}
else{
document.getElementById(obj).innerHTML=" <font color=red>密码输入正确!</font>";
}
}
wang_quan_li
2009-05-20
打赏
举报
回复
<?
session_start();
$myCxmis = new Cxmis;
if($mysubmit =="确定"){
$result = $myCxmis->register($username,$password);
if($result==2){
$uid=$username;
session_register('uid');
?>
<script language="javascript">
alert("注册成功");
window.location='ywsljj.php';
</script>
<?
}else if($result==1){
?>
<script language="javascript">
alert("此用户名已经存在,请重新注册");
window.location='javascript:history.back(-1)';
</script>
<?
}else{
?>
<script language="javascript">
alert("注册失败,请重新注册");
window.location='javascript:history.back(-1)';
</script>
<?
}}else {
?>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<script language="Javascript" src="/script/checkpassword.js"></script>
<script language="Javascript" src="/script/ajaxreg.js"></script>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<div align="left">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
<?
require("./include/top.inc");
?>
<tr>
<td align="left" valign="top">
<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" width="235">
<table border="0" width="100%" id="table19" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
</td>
</tr>
<tr>
<td>
<img border="0" src="images/zjcx_ml_11_01.gif" width="235" height="166"></td>
</tr>
</table>
</td>
<td align="left" valign="top">
<table border="0" width="100%" id="table14" cellspacing="0" cellpadding="0">
<tr>
<td width="22">
<img border="0" src="images/zjcx_07_01.gif" width="22" height="16"></td>
<td background="images/zjcx_07_02.gif">
<img border="0" src="images/zjcx_07_02.gif" width="745" height="16"></td>
</tr>
<tr>
<td background="images/zjcx_07_03.gif" height="380" width="22">
<img border="0" src="images/zjcx_07_03.gif" width="22" height="50"></td>
<td align="left" valign="top">
<table border="0" width="100%" id="table15" cellspacing="0" cellpadding="0">
<tr>
<td>
<p align="center">帐 号 注 册
<!--img border="0" src="images/zjcx_07_04_01.gif" width="745" height="35"--></td>
</tr>
<tr>
<td>
<table border="0" width="100%" id="table16" cellspacing="0" cellpadding="0">
<tr>
<td width="363">
<img border="0" src="images/zjcx_07_08_01.gif" width="363" height="17"></td>
<td background="images/zjcx_07_08_02.gif">
<img border="0" src="images/zjcx_07_08_02.gif" width="9" height="17"></td>
<td width="373">
<img border="0" src="images/zjcx_07_08_03.gif" width="373" height="17"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table border="0" width="98%" id="table18" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name=reg method=post action="/register.php" onsubmit="return checkpwd(this)">
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#9ad0eb">
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#9ad0eb" width="100%">
<tr bgcolor="#e4f2fa"> <td colspan=3>帐号注册</td></tr>
( * 为必填项)
<tr bgcolor="#e4f2fa">
<td >
<div align="center">用户名<font color="#FF0000">*</font></div>
</td>
<td >
<input type="text" name="username" id="username" size="25" maxlength="15" onBlur="return usercheck('check')">
</td>
<td align="left" bgcolor="#FFFFFF"><!--input type=button value='检查用户名' onclick="return usercheck('check')"--><span id="check"> 3-16个字符,英文小写、汉字、数字、最好不要全部是数字。</span></td>
</tr>
<tr bgcolor="#e4f2fa">
<td >
<div align="center">密码<font color="#FF0000">*</font></div>
</td>
<td >
<input type="password" name="password" id="userpwd" onBlur="pwdcheck('pwd')">
</td>
<td align="left" bgcolor="#FFFFFF" id="pwd"> 密码字母有大小写之分。6-16位(包括6、16),限用英文、数字。</td>
</tr>
<tr bgcolor="#e4f2fa">
<td >
<div align="center">确认密码<font color="#FF0000">*</font></div>
</td>
<td >
<input type="password" name="checkpassword" id="reuserpwd" onBlur="pwdrecheck('repwd')">
</td>
<td align="left" bgcolor="#FFFFFF" id="repwd"> 请再次输入登录密码。</td>
</tr>
<tr bgcolor="#e4f2fa"><td colspan=3 align="center">
<input type="submit" name=mysubmit value="确定">
<input type=reset value="重填">
</td></tr>
</table>
</form>
<!--文字内容结束--></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" width="100%" id="table17" cellspacing="0" cellpadding="0">
<tr>
<td width="363">
<img border="0" src="images/zjcx_07_08_01.gif" width="363" height="17"></td>
<td background="images/zjcx_07_08_02.gif">
<img border="0" src="images/zjcx_07_08_02.gif" width="9" height="17"></td>
<td width="373">
<img border="0" src="images/zjcx_07_08_03.gif" width="373" height="17"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<?
require("./include/bottom.inc");
?>
</table>
</div>
</body>
</html>
<?
}
$myCxmis->Destroy();
?>
php
理解递归
本文通过一个简单的
PHP
递归
代码
示例介绍了如何理解递归的概念。使用
求
阶乘的
例子
详细解释了递归函数的工作原理。
用
PHP
计算奇数之和,
PHP
程序查找奇数个自然数的立方和
该博客展示了一个
PHP
函数,用于计算从0开始的前n个偶数自然数的立方和。
代码
通过遍历一个for循环,对每个偶数
求
立方并累加到初始和中。在给定的
例子
中,函数被调用计算前8个偶数的立方和,结果为3968。
30个
php
操作redis常用方法
代码
例子
本文介绍了30个
PHP
操作Redis的常用方法
代码
例子
,这些
例子
基于
php
- redis扩展,可操作string、list和set类型的数据,涵盖连接、设置、获取、删除等多种操作,为需要使用
PHP
处理Redis的开发者提供参考。
PHP
用函数
求
素数,
php
求
质素(素数) 的实现
代码
本文详细介绍了
PHP
中
求
质数的算法实现,包括IsPrime函数的
代码
,并探讨了如何利用计时器功能评估效率。同时,还涉及到了寻找水仙花数的编程练习,帮助读者提升基础编程技巧。
php
代码
实例强制下载文件
代码
例子
博客提供了
PHP
代码
实例,包含强制下载文件和从网上下载文件的
代码
例子
,聚焦于
PHP
在文件下载方面的应用。
PHP
20,393
社区成员
19,656
社区内容
发帖
与我相关
我的任务
PHP
“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法利用了C、Java和Perl,该语言的主要目标是允许web开发人员快速编写动态网页。
复制链接
扫一扫
分享
社区描述
“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法利用了C、Java和Perl,该语言的主要目标是允许web开发人员快速编写动态网页。
php
phpstorm
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章