%windir%\System32\SlideToShutDown.exen作者: Jefsky
-
开启win10滑动关机
n -
http怎么做自动跳转https
nApache 版本
nnnn整站跳转,则在网站的配置文件的标签内:
nnnn
nnnnRewriteEngine onnnRewriteCond %{SERVER_PORT} !^443nnRewriteRule ^(.*)? https://%{SERVER_NAME}/$1 [L,R=301]n对某个目录做https强制跳转:
nnnn
nnnnRewriteEngine onn对某个网页进行https跳转,可以使用redirect 301来做跳转!redirect 301 /你的网页 https://你的主机+网页
nnnnNginx版本
nnnn配置80端口的文件里面,写入以下内容
nnnn
nnnnserver {nn listen 80;nn server_name localhost;nn rewrite ^(.*)https://host$1 permanent; nn }nnnIIS 版本
nnnnIIs中实现Http自动转换到Https方法介绍 (403跳转对SEO有一定影响)
nnnn1、根据IIS版本备份以下文件:
nnnn
IIS6.0 路径:C:WINDOWSHelpiisHelpcommon403-4.htmIIS7.0以上 路径:C:inetpubcusterrzh-CN403.htm
nnnn2、把以下内容全部拷贝替换(403-4或403)里面所有内容,保存即可
nnnn
nnnn<script type="text/javascript">nnvar url = window.location.href;nn if (url.indexOf("https") < 0) {nn url = url.replace("http:", "https:");nn window.location.replace(url);nn }nn</script>nn注释:IIS6中,站点属性-》目录安全性-》编辑中把“要求安全通道(SSL)”勾选上即可。
nnnn
IIS7、8中,SSL设置-》把“要求SSL”勾选即可。TOMCAT 版本
nnnn1、在conf目录下的server.xml文件中找到以下配置,修改redirectPort参数值为”443″,默认是“8443”.
nnnn2、在conf目录下的web.xml文件内容……中增加以下配置。
nnnn
nnnn<web-app>nn.........nn<security-constraint>nn <web-resource-collection > nn <web-resource-name >SSL</web-resource-name> nn <url-pattern>/*</url-pattern>nn </web-resource-collection> nn <user-data-constraint>nn<transport-guarantee>CONFIDENTIAL</transport-guarantee>nn </user-data-constraint>nn</security-constraint>nn</web-app>nn单独页面通用代码段
nnnn在需要强制为https的页面上加入以下代码进行处理http–>https
nnnn
nnnn<script type="text/javascript">nn var url = window.location.href;nn if (url.indexOf("https") < 0) {nn url = url.replace("http:", "https:");nn window.location.replace(url);nn }nn</script>nPHP页面跳转
nnnn
nif (_SERVER["HTTPS"] <> "on") nn{ nnxredir="https://"._SERVER["SERVER_NAME"]._SERVER["REQUEST_URI"]; nnheader("Location: ".$xredir); nn}nn -
终于解决typecho自带编辑器的不方便了
n关于typecho自带的markdown解析引擎可以使用parsedown插件替换: kokororin / typecho-plugin-parsedown
nnnn启用该插件后,无需任何设置,自动替换前台文章解析,支持解析表格和html代码。
nnnn关于编辑器,这里推荐ue ueditor for typecho 2018
nnnn安装方式1:在线安装
nnnn使用ueditor.install.php在服务器上下载和安装
nnnn访问https://github.com/chanshengzhi/ueditor-for-typecho/releases
nnnn下载最新版本的安装脚本(ueditor.install.php)
nnnn上传到ueditor.install.php到/usr/plugins文件夹下
nnnn访问yourdomain.com/usr/plugins/ueditor.install.php进行安装
nnnn安装成功后进入typecho插件管理界面启用即可.
nnnn安装方式2:下载安装
nnnn访问https://github.com/chanshengzhi/ueditor-for-typecho/releases,下载所需版本的压缩包,解压后上传其中的ueditor文件夹到/usr/plugins文件夹下, 进入typecho插件管理界面启用即可
nnnntypecho parsedown 解析markdown插件
n
使用parsedown替换typecho自带的markdown解析库。启用前请将目录名重命名为parsedown。 -
增加hosts记录
n
n@echo offnnset /p url=请输入域名地址:nnset /p ip=请输入IP地址:nnset hosts=%systemroot%\System32\drivers\etc\hostsnnattrib -h -s -r "%hosts%"nn(echo %ip% %url%)>>"%hosts%"nnattrib +h +r +s "%hosts%"nnipconfig /flushdnsnnpause -
console花式log
nconsole.log利用占位符格式化打印
nnnn
%c表示css样式
nnnnconsole.log('%c hello jefsky', 'color: yellow;font-size: 24px;font-weight: bold;text-decoration: underline;');n%d 或 %i表示整型
nnnn
nnnnconsole.log('%d', 123);nn console.log('%i', 123);n%f表示浮点型
nnnn
nnnnconsole.log('%f', 123.321);n%o表示DOM元素
nnnn
nnnnconsole.log('%o', document.body);n%O表示javascript对象
nnnn
nnnnconsole.log('%O', new Date());nconsole对象的其他属性
nnnnassert: ƒ assert()
nnnnclear: ƒ clear()
nnnncontext: ƒ context()
nnnncount: ƒ count()
nnnncountReset: ƒ countReset()
nnnndebug: ƒ debug()
nnnndir: ƒ dir()
nnnndirxml: ƒ dirxml()
nnnnerror: ƒ error()
nnnngroup: ƒ group()
nnnngroupCollapsed: ƒ groupCollapsed()
nnnngroupEnd: ƒ groupEnd()
nnnninfo: ƒ info()
nnnnlog: ƒ log()
nnnnmemory: (…)
nnnnprofile: ƒ profile()
nnnnprofileEnd: ƒ profileEnd()
nnnntable: ƒ table()
nnnntime: ƒ time()
nnnntimeEnd: ƒ timeEnd()
nnnntimeLog: ƒ timeLog()
nnnntimeStamp: ƒ timeStamp()
nnnntrace: ƒ trace()
nnnnwarn: ƒ warn()
nnnn有兴趣的可以在你的浏览器console中尝试一下
n -
tp5.0 PHP8.0报错Method ReflectionParameter::getClass() is deprecated
n$class = $param->getClass();
n
//更换为
$class = $param->getType(); -
宝塔部署时,出现“open_basedir restriction in effect”错误
n错误信息:
nnnn
Warning: require(): open_basedir restriction in effect.
Warning: require(XXXXXXXXXXX): failed to open stream: Operation not permitted in XXXX解决方案:
n
更改宝塔网站配置:去掉勾选防跨站攻击(open_basedir); -
ubuntu18.04安装了phpmyadmin之后,root账户不能登录
ubuntu18.04安装了phpmyadmin之后,root账户不能登录,但在终端中sudo mysql -u root -p仍然可以用root登录。
nn
显示ERROR 1698: Access denied for user ‘root’@’localhost’
nn
用phpmyadmin账户登录以后,看不到其他数据库,没有权限
nn
解决方法一:
nn
创建一个新用户并授予所需的权限。
nn
MySQL赋予用户权限的命令的格式为:
grant 权限 on 数据库对象 to 用户 identified by “密码”nn
1、连接数据库
nn
sudo mysql -u root -p
nn
2、创建一个赋予权限的账户(例如 root_sql)
nn
CREATE USER 'root_sql'@'localhost' IDENTIFIED BY 'yourpasswd';nGRANT ALL PRIVILEGES ON *.* TO 'root_sql'@'localhost' WITH GRANT OPTION;nFLUSH PRIVILEGES;
nn
3、更新phpMyAdmin配置
nn
打开文件/etc/dbconfig-common/phpmyadmin.conf,修改你的配置文件内容
nn
# dbc_dbuser: database usern# the name of the user who we will use to connect to the database.ndbc_dbuser='root_sql'n n# dbc_dbpass: database user passwordn# the password to use with the above username when connectingn# to a database, if one is requiredndbc_dbpass='yourpasswd'
nn
解决方法二:
nn
给phpmyadmin账户赋予所有权限,那么你只要执行
nn
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' IDENTIFIED BY 'yourpasswd';nFLUSH PRIVILEGES;
-
javascript中何时this何时that
nthis是Javascript中的一个关键字。
nnnn当函数运行时,会自动生成的一个内部对象,this代表的就是当前对象,只能在当前函数内部使用,注意这里很重要是当前函数内部!!!因为很多时候会函数中有函数,这个时候,我们就需要把外部函数对象this复制一份了,所以就有了var that=this,that就在里面的函数中用外面的函数对象,这样就不会出现报错说没有什么对象或者变量了。
nnnn
n$(‘#div.clickme').click(function(){nn //此时,this就是#div.clickme这个对象nn var that = this; //复制,把this对象复制到thatnn $(‘#.loop').each(function(){nn //此时,this就成了each遍历到的.loop对象nn //that是外面的那个#div.clickme对象nn });nn});n -
Typecho访客阅读数统计
n
n在当前主题function.php中加上n/*n * 无插件阅读数n*/nfunction get_post_view(archive)n{ncid = archive->cid;ndb = Typecho_Db::get();nprefix =db->getPrefix();nif (!array_key_exists('views', db->fetchRow(db->select()->from('table.contents')))) {n db->query('ALTER TABLE `' .prefix . 'contents` ADD `views` INT(10) DEFAULT 0;');n echo 0;n return;n}nrow =db->fetchRow(db->select('views')->from('table.contents')->where('cid = ?',cid));nif (archive->is('single')) {ndb->query(db->update('table.contents')->rows(array('views' => (int)row['views'] + 1))->where('cid = ?', cid));n}nechorow['views'];n }n前台调用n<?php get_post_view($this) ?>