一、error:function (XMLHttpRequest, textStatus, errorThrown) { } (默认: 自动判断 (xml 或 html)) 请求失败时调用时间。参数有以下三个:XMLHttpRequest 对象、错误信息、(可选)捕获的错误对象。如果发生了错误,错误信息(第二个参数)除了得到null之外,还可能是"timeout", "error", "notmodified" 和 "parsererror"。textStatus:"timeout", "error", "notmodified" 和 "parsererror"。二、error事件返回的第一个参数XMLHttpRequest有一些有用的信息:XMLHttpRequest.readyState:状态码 0 - (未初始化)还没有调用send()方法 1 - (载入)已调用send()方法,正在发送请求 2 - (载入完成)send()方法执行完成,已经接收到全部响应内容 3 - (交互)正在解析响应内容 4 - (完成)响应内容解析完成,可以在客户端调用了三、data:"{}", dat
本章介绍的是Cookie/Session与LocalStorage的操作代码案例Cookie通过setcookie关闭广告index.php (广告展示页)//index.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <body> <style> div{ height:200px; width:200px; background-color: hotpink; } </style> </body> </head> <?php if(empty($_COOKIE['hide_ad'])||$_COOKIE['hide_ad']!='1'): ?> //
今天要讲的是API的使用,包括自己写函数/api 与如何调用他人写的api。自己写函数/api创建函数function postback(){ if(empty($_POST['username'])){ $message='请输入用户名'; return; } }调用函数<?php if($_SERVER['REQUEST_METHOD']==='POST'){ postback(); //调用postback函数 } ?>调用外部网站API调用微信扫码API微信开发文档:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115前提:要有公众号,并通过微信认证,绑定域名,得到相应信息:appid,appsecret等。调用步骤1.引入JS文件2.config接口注入权限验证配置<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" ty
本次介绍的是 列表展示|TAB页的代码写法示例纯html写法<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html> <html lang="en">
本节的内容包括:增删改查数据、保存数据 、读取json到php。增删改查数据//insert语句 $insert = "insert into user (username,password,phone) values ('$username','$password','$phone')"; //delete语句 $sql = "delete from bbs_user where id =$id"; //更改语句 $sql = "update bbs_user set username = '$username', address = '$address', sex = '$sex', age = '$age' where id =$id"; //查询语句 $sql = "select * from bbs_user where id=$id";保存数据从php保存到json<?php // 生成一个PHP数组 $data = array(); $data['a'] = 'test'; $da
上传文件页的功能代码上传文件页uploadfile.php<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <h1>上传文件</h1> <form action="chuli.php" method="post" enctype="multipart/form-data"> 请选择文件:<input type="file" name="file" /><input type="submit" value="
提交表单的功能代码。客户端表单的注意事项1.必须要有form标签2.form 必须指定action 和method ,不设置 action 默认是当前页面,不设置method默认是GET。3.表单元素(表单域如:input )必须有name属性。4.表单中必须有一个提交按钮。<!--表单各类元素的样式一览--> <form method="post/get" > <!--文本输入--> <input type="text" /> <!--文本框--> <input type="password" /> <!--密码框--> <input type="hidden" /> <!--隐藏域--> <textarea></textarea> <!--文本域--> <!--按钮输入--> <input type="subm
以下摘录了一些网站常备的功能代码:包括但不仅限于登录、注册、登录处理和主页。登录页login.html<form action="login.php" method="post"> <fieldset> <legend>用户登录</legend> <ul> <li> <label>用户名:</label> <input type="text" name="username"> </li> <li> <label>密 码:</label>
解决办法如下<?php $efly_id= $_REQUEST["efly_id"]; echo $efly_id; $mysql_server="localhost"; $mysql_user="root"; $mysql_password="123456"; $mysql_database="efly_service_database"; echo $mysql_database; // $mysqli = new mysqli(‘localhost’,’root’,’password’,’dbname’);//mysqli链接数据库的写法 $conn=new mysqli($msql_server,$mysql_user,$mysql_password,$mysql_database); if(!$conn->connec
解决方法是使用FTP工具FileZilla来删除,操作方法如下:文件---站点管理器---字符集---自定义字符集编码为gb2312设置完成后可以登陆到ftp进行重命名操作,重命名操作完成后,如果需要删除的文件比较多,使用cpanel控制面板文件管理器直接删除整个文件夹。参考下图设置:
茶特喵
可可爱爱