关闭WPS弹窗广告
C:\Users\Administrator\AppData\Local\kingsoft\WPS Office\11.1.0.12358\office6\ksomisc.exe
双击进入高级设置
或者在桌面wps图标上点右键》打开文件所在位置进入目录找到 ksomisc.exe 》双击运行》高级》其他选项》关闭广告弹窗推送,确定
抓包工具charles
js 字符和unicode互转
String.fromCharCode(97); //a String.fromCharCode(97,97); //aa String.fromCharCode(20013); //中 '中国'.charCodeAt(0); //20013
PHP文件系统函数
- basename — 返回路径中的文件名部分
- chgrp — 改变文件所属的组
- chmod — 改变文件模式
- chown — 改变文件的所有者
- clearstatcache — 清除文件状态缓存
- copy — 拷贝文件
- delete — 参见 unlink 或 unset
- dirname — 返回路径中的目录部分
- disk_free_space — 返回目录中的可用空间
- disk_total_space — 返回一个目录的磁盘总大小
- diskfreespace — disk_free_space 的别名
- fclose — 关闭一个已打开的文件指针
- fdatasync — Synchronizes data (but not meta-data) to the file
- feof — 测试文件指针是否到了文件结束的位置
- fflush — 将缓冲内容输出到文件
- fgetc — 从文件指针中读取字符
- fgetcsv — 从文件指针中读入一行并解析 CSV 字段
- fgets — 从文件指针中读取一行
- fgetss — 从文件指针中读取一行并过滤掉 HTML 标记
- file_exists — 检查文件或目录是否存在
- file_get_contents — 将整个文件读入一个字符串
- file_put_contents — 将一个字符串写入文件
- file — 把整个文件读入一个数组中
- fileatime — 取得文件的上次访问时间
- filectime — 取得文件的 inode 修改时间
- filegroup — 取得文件的组
- fileinode — 取得文件的 inode
- filemtime — 取得文件修改时间
- fileowner — 取得文件的所有者
- fileperms — 取得文件的权限
- filesize — 取得文件大小
- filetype — 取得文件类型
- flock — 轻便的咨询文件锁定
- fnmatch — 用模式匹配文件名
- fopen — 打开文件或者 URL
- fpassthru — 输出文件指针处的所有剩余数据
- fputcsv — 将行格式化为 CSV 并写入文件指针
- fputs — fwrite 的别名
- fread — 读取文件(可安全用于二进制文件)
- fscanf — 从文件中格式化输入
- fseek — 在文件指针中定位
- fstat — 通过已打开的文件指针取得文件信息
- fsync — Synchronizes changes to the file (including meta-data)
- ftell — 返回文件指针读/写的位置
- ftruncate — 将文件截断到给定的长度
- fwrite — 写入文件(可安全用于二进制文件)
- glob — 寻找与模式匹配的文件路径
- is_dir — 判断给定文件名是否是一个目录
- is_executable — 判断给定文件名是否可执行
- is_file — 判断给定文件名是否为一个正常的文件
- is_link — 判断给定文件名是否为一个符号连接
- is_readable — 判断给定文件名是否可读
- is_uploaded_file — 判断文件是否是通过 HTTP POST 上传的
- is_writable — 判断给定的文件名是否可写
- is_writeable — is_writable 的别名
- lchgrp — 修改符号链接的所有组
- lchown — 修改符号链接的所有者
- link — 建立一个硬连接
- linkinfo — 获取一个连接的信息
- lstat — 给出一个文件或符号连接的信息
- mkdir — 新建目录
- move_uploaded_file — 将上传的文件移动到新位置
- parse_ini_file — 解析一个配置文件
- parse_ini_string — 解析配置字符串
- pathinfo — 返回文件路径的信息
- pclose — 关闭进程文件指针
- popen — 打开进程文件指针
- readfile — 输出文件
- readlink — 返回符号连接指向的目标
- realpath_cache_get — 获取真实目录缓存的详情
- realpath_cache_size — 获取真实路径缓冲区的大小
- realpath — 返回规范化的绝对路径名
- rename — 重命名一个文件或目录
- rewind — 倒回文件指针的位置
- rmdir — 删除目录
- set_file_buffer — stream_set_write_buffer 的别名
- stat — 给出文件的信息
- symlink — 建立符号连接
- tempnam — 建立一个具有唯一文件名的文件
- tmpfile — 建立一个临时文件
- touch — 设定文件的访问和修改时间
- umask — 改变当前的 umask
- unlink — 删除文件
【严重】程序开发中"删除"功能需要特别注意的地方
请输入查看密码:js下载文件
普通的jQuery中的ajax请求后台,并不能处理Blob类型的数据,这里用的原生的XMLHttpRequest请求后台
转自:https://blog.csdn.net/lf1934305268/article/details/123401275
var xhr = new XMLHttpRequest();
xhr.open("get",url, true);
xhr.responseType = "blob";
xhr.onload = function() {
if (this.status == 200) {
$.unblockUI();
var blob = this.response;
if(blob.type == "text/html"){
return false
}
var fileName = "aaaa.xlsx";
if(window.navigator.msSaveOrOpenBlob){ // IE浏览器下
navigator.msSaveBlob(blob, fileName);
} else {
var link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = fileName;
link.click();
window.URL.revokeObjectURL(link.href);
}
}else{
}
}另:IE浏览器已不再使用,可以删除对IE浏览器的判断
我的代码:
var xhr = new XMLHttpRequest();
xhr.timeout = 600000; //设置超时毫秒数(0为永不超时)
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onload = function(){
if(this.status != 200){
return;
}
var blob = this.response;
if(blob.type == "text/html"){
console.log('error');
return false;
}
var allow_type=['video/quicktime','video/mp4'];
if(allow_type.indexOf(blob.type)==-1){
console.log('content-type not allowed');
return false;
}
console.log(filename+' 下载完成,大小'+blob.size+'字节');
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(a.href);
}
xhr.onerror = function(){
console.log('error');
console.log(this.status);
console.log(this);
}
xhr.ontimeout = function(){
console.log('timeout');
console.log(this.status);
console.log(this);
}
xhr.send();
localStorage简明教程
localStorage API(属性和方法):
length:返回 localStorage 中的键值对的数目
setItem():增加一个键值对到 localStorage 中
getItem():从 localStorage 中查询指定 key 的值
removeItem():从 localStorage 中删除指定的键值对
clear():清空 localStorage 中所有键值对
key(): 传入一个数字 n,用于返回指定第 n 个键的名字

PHP常用header状态
转自:https://www.cnblogs.com/limeng951/p/5634107.html
<?php
//200 正常状态
header('HTTP/1.1 200 OK');
// 301 永久重定向,记得在后面要加重定向地址 Location:$url
header('HTTP/1.1 301 Moved Permanently');
// 重定向,其实就是302 暂时重定向
header('Location: http://www.maiyoule.com/');
// 设置页面304 没有修改
header('HTTP/1.1 304 Not Modified');
// 显示登录框,
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="登录信息"');
echo '显示的信息!';
// 403 禁止访问
header('HTTP/1.1 403 Forbidden');
// 404 错误
header('HTTP/1.1 404 Not Found');
// 500 服务器错误
header('HTTP/1.1 500 Internal Server Error');
// 3秒后重定向指定地址(也就是刷新到新页面与 <meta http-equiv="refresh" content="10;http://www.jb51.net/ /> 相同)
header('Refresh: 3; url=http://www.jb51.net/');
echo '10后跳转到http://www.jb51.net';
// 重写 X-Powered-By 值
header('X-Powered-By: PHP/5.3.0');
header('X-Powered-By: Brain/0.6b');
//设置上下文语言
header('Content-language: en');
// 设置页面最后修改时间(多用于防缓存)
$time = time() - 60; //建议使用filetime函数来设置页面缓存时间
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
// 设置内容长度
header('Content-Length: 39344');
// 设置头文件类型,可以用于流文件或者文件下载
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');
header('Content-Transfer-Encoding: binary');
readfile('example.zip');//读取文件到客户端
//禁用页面缓存
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Pragma: no-cache');
//设置页面头信息
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain');
header('Content-Type: image/jpeg');
header('Content-Type: application/zip');
header('Content-Type: application/pdf');
header('Content-Type: audio/mpeg');
header('Content-Type: application/x-shockwave-flash');
//.... 至于Content-Type 的值 可以去查查 w3c 的文档库,那里很丰富
?>Ueditor配置
1、宽度自适应:设置 initialFrameWidth: null
var ue = UE.getEditor('editor',{
initialFrameWidth:null, //宽度随浏览器自适应
wordCount: false, //关闭字数统计
elementPathEnabled : false, //隐藏元素路径
autoHeightEnabled: false, //是否自动长高
autoFloatEnabled: false, //是否保持toolbar的位置不动
allowDivTransToP: false, //阻止div标签自动转换为p标签
});2、高度自适应:设置 '#edui1' 和 '#edui1_iframeholder' 的高度
css中设置:
#edui1 {
height: 100%;
}js中设置(编辑器显示时):
$('#edui1_iframeholder').css('height','calc(100% - 10px)');3、扩展
ue.setDisabled();//不可编辑
设置页面不缓存的方法
转自:https://www.php.cn/php-ask-454686.html
一般我们要查看网上的一个网页,那么当您第一次访问这个网页的时候,系统首先要将这个网页下载到您的本地计算机的一个临时文件夹中进行缓存,当在一定的时间内,您第二次、第三次来访问这个网页的时候,浏览器就直接从您的本地计算机的临时文件夹中读取这个文件显示,这样做的好处就是避免每次都要重新下载而占用大量的时间和网络资源,不得不说页面的缓存加快了网页的显示,当然也有它的坏处,例如当服务器上的网页己经更新,而本地显示的还是没有更新的网页,这样就不能及时的显示更新后的内容,在某些情况下,我们需要禁止浏览器缓存,以使我们每次看到的页面都是最新的页面(例如后台操作、大型网站的实时新闻页面),这时我们就要禁用浏览器缓存,下面分别说明了在四种不同的页面环境下来禁止网页缓存:
一、对于静态页(就是通过meta标签来设置):
<!--expires用于设定网页的过期时间,一旦过期就必须从服务器上重新加载.时间必须使用GMT格式--> <meta http-equiv="expires" content="Sunday 26 October 2008 01:00 GMT" />
或者通过pragma no-cache来设置,pragma出现在http-equiv属性中,使用content属性的no-cache值表示是否缓存网页(为了提高速度一些浏览器会缓存浏览者浏览过的页面,通过下面的定义,浏览器一般不会缓存页面,而且浏览器无法脱机浏览)。
二、对于ASP页面:
<% Response.Buffer=true Response.CacheControl="no-cache" '禁止代理服务器缓存本页面 Response.Expires=-1000 '让页面立即过期(这儿最好设置一个绝对值较大的负数) %>
三、对于JSP页面:
<%
if(request.getProtocol().compareTo("HTTP/1.0")==0){
response.setHeader("Pragma","no-cache");
}
if(request.getProtocol().compareTo("HTTP/1.1")==0){
response.setHeader("Cache-Control","no-cache");
}
response.setDateHeader("Expires",0);
%>四、对于PHP页面:
<?php
header('Cache-Control:no-cache,must-revalidate');
header('Pragma:no-cache');
?>强调说明:对于动态页面,缓存的代码必须放在任何HTML标签输出之前,否则将会出错。
