Peak Xin

小峰的博客


  • 首页

  • 标签

  • 分类

  • 归档

  • 优秀资源

  • 搜索

解决PHP报错 cURL error 60: SSL certificate problem: unable to get local issuer certifica

发表于 2021-07-29 | 分类于 后端开发 , PHP |
字数统计: 167 | 阅读时长 ≈ 1

PHP程序在调用https链接时报错”cURL error 60: SSL certificate problem: unable to get local issuer
certifica”,这是因为没有配置信任的服务器HTTPS验证。默认情况下,cURL被设为不信任任何CAS,因此浏览器无法通过HTTPS访问你服务器

解决方法:

阅读全文 »

Yii2 form 表单用法

发表于 2021-06-23 | 分类于 PHP框架 , Yii |
字数统计: 929 | 阅读时长 ≈ 4

表单的创建

  • 在Yii中主要通过 yii\widgets\ActiveForm类来创建表单
  • ActiveForm::begin()不仅创建了一个表单实例,同时也标志着表单的开始
  • 放在 ActiveForm::begin() 和 ActiveForm::end() 之间的所有内容都被包裹在 html 的 form 标签中
  • 中间是通过调用 ActiveForm::field() 方法来创建一个 ActiveForm 实例,这个实例会创建表单元素与元素的标签,以及对应的 js 验证
  • ActiveField 有一个对应的模型和属性, input 输入框的 name 属性会自动的根据属性名来创建,同时,还会用属性的验证规则来验证用户输入的数据

e.g.

阅读全文 »

如何关闭MySQL日志,删除mysql-bin.0000*日志文件

发表于 2021-06-02 | 分类于 数据库 , MySQL |
字数统计: 396 | 阅读时长 ≈ 1

LNMP一键安装包安装的MySQL默认是开启了二进制日志文件的,如果数据操作比较频繁就会产生大量的日志,在/usr/local/mysql/var/下面产生mysql-bin.0000* 类似的文件,而且一般都在几十MB到几个GB,更甚会吃掉整个硬盘空间,从来导致mysql无法启动或报错。

如何关闭MySQL的日志功能:

阅读全文 »

LNMP环境 Nginx 502 Bad Gateway错误可能原因及解决方法

发表于 2021-06-02 | 分类于 运维实战 |
字数统计: 1.1k | 阅读时长 ≈ 4

在使用lnmp环境时,偶尔会遇到nginx返回502错误,这里我以lnmp一键安装进行说明

原因一:安装时php没有安装成功

查看一下是否存在/usr/local/php/sbin/php-fpm,如果没有肯定没安装成功。

原因二:eaccelerator配置项

在php.ini里,eaccelerator配置项一定要放在Zend Optimizer配置之前,否则也可能引起502 Bad Gateway。php一些模块之间也可能会造成502,如Zend GuardLoader与Opcache,ioncube与Zend GuardLoader等,一般可以通过注释掉一个然后重启php-fpm,然后看是否还502进行排除。

原因三:php-cgi进程

在安装好使用过程中出现502问题,一般是因为默认php-cgi进程是5个,可能因为phpcgi进程不够用而造成502,需要修改/usr/local/php/etc/php-fpm.conf 将其中的max_children值适当增加,如果php已升级到5.3.*以上且使用的是dynamic模式,需要调整pm.min_spare_servers和pm.max_spare_servers的值适当增加。

阅读全文 »

CentOS6.5配置阿里云yum源后报错 http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml The requested URL returned error: 404 Not Found

发表于 2021-05-25 | 分类于 运维实战 |
字数统计: 225 | 阅读时长 ≈ 1

CentOS6.5在配置阿里云yum源后,更新缓存发生报错

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
阅读全文 »

解决Git冲突:Please commit your changes or stash them before you can merge

发表于 2021-05-21 | 分类于 版本管理 |
字数统计: 455 | 阅读时长 ≈ 1

服务器更新代码git pull的时候有冲突

1
2
3
4
5
6
7
Updating 6517e7c..d208dd9
error: Your local changes to the following files would be overwritten by merge:
api/common.php
app/portal/model/ReservationModel.php
composer.lock
Please, commit your changes or stash them before you can merge.
Aborting

出现这个问题的原因是版本库提交了新代码,而你服务器也修改了对应文件的代码,
这时候你进行git pull操作就好出现冲突了,解决方法,在上面的提示中也说的很明确了。

阅读全文 »

安装 closurecompiler@1.6.1 失败

发表于 2021-04-13 | 分类于 Nodejs |
字数统计: 446 | 阅读时长 ≈ 2

在安装grunt的时候,提示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$ cnpm i
√ Installed 8 packages
√ Linked 53 latest versions
[1/1] scripts.install grunt-closurecompiler@0.9.9 ? closurecompiler@>=1.2 run "npm run-script configure", root: "D:\\phpStudy\\PHPTutorial\\WWW\\gdfront\\ueditor_old\\node_modules\\_closurecompiler@1.6.1@closurecompiler"

> closurecompiler@1.6.1 configure D:\phpStudy\PHPTutorial\WWW\gdfront\ueditor_old\node_modules\_closurecompiler@1.6.1@closurecompiler
> node scripts/configure.js

Configuring ClosureCompiler.js 1.6.1 ...

Downloading https://dl.google.com/closure-compiler/compiler-latest.tar.gz ...
? Download failed: Error: Download failed: HTTP status code 404

? Unfortunately, ClosureCompiler.js could not be configured.
See: https://github.com/dcodeIO/ClosureCompiler.js (create an issue maybe)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! closurecompiler@1.6.1 configure: `node scripts/configure.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the closurecompiler@1.6.1 configure script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Caffrey\.npminstall_tarball\_logs\2021-04-13T06_53_17_040Z-debug.log
[npminstall:runscript:error] grunt-closurecompiler@0.9.9 ? closurecompiler@>=1.2 scripts.install run "npm run-script configure" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c npm run-script configure" error, exit code 1
at ChildProcess.<anonymous> (D:\nvm\v12.18.0\node_modules\cnpm\node_modules\runscript\index.js:96:21)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
stdio: [Object],
exitcode: 1
}
× Install fail! RunScriptError: post install error, please remove node_modules before retry!
Run "C:\Windows\system32\cmd.exe /d /s /c npm run-script configure" error, exit code 1
RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c npm run-script configure" error, exit code 1
at ChildProcess.<anonymous> (D:\nvm\v12.18.0\node_modules\cnpm\node_modules\runscript\index.js:96:21)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
npminstall version: 3.28.0
npminstall args: D:\Program Files\nodejs\node.exe D:\nvm\v12.18.0\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\Caffrey\.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org
阅读全文 »

JS点击空白处关闭弹窗方法

发表于 2021-03-11 | 分类于 前端开发 , JavaScript |
字数统计: 521 | 阅读时长 ≈ 2

第一种 jQuery 写法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en" style="width: 100%;height: 100%;">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style type="text/css">
html,
body {
width: 100%;
height: 100%;
border: 0;
margin: 0;
}

.dialog {
width: 100%;
height: 100%;
position: relative;
background: rgba(0, 0, 0, 0.1);
}

.dialog .dialog-content {
width: 200px;
border: 1px solid #eeeeee;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #FFF;
box-shadow: 1px 1px 10px #888888;
text-align: center;
line-height: 100px;
}
</style>
<body style="width: 100%;height: 100%;">
<div class="dialog">
<div class="dialog-content">
<p>这是弹窗</p>
</div>
</div>
<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).mouseup(function(e) {
var dc = $('.dialog-content'); // 目标区域,弹窗内容区域
// 如果点击的 不是目标区域 并且 不是目标区域的子元素
if (!dc.is(e.target) && dc.has(e.target).length === 0) {
// some code...
$('.dialog').hide();
}
});
</script>
</body>

</html>

判断点击事件发生在区域外的条件是:

  • 点击事件的对象不是目标区域本身
  • 事件对象同时也不是目标区域的子元素
阅读全文 »

百度编辑器UEditor去除复制样式实现无格式粘贴

发表于 2021-02-19 | 分类于 前端框架 , 编辑器 |
字数统计: 507 | 阅读时长 ≈ 2

百度编辑器UEditor内置了无格式粘贴功能,只需要对ueditor/ueditor.config.js文件简单的配置即可。

  1. 开启retainOnlyLabelPasted,设置为true
1
2
//粘贴只保留标签,去除标签所有属性
,retainOnlyLabelPasted: true
  1. 开启pasteplain,设置为true
1
,pasteplain:true  //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
阅读全文 »

百度编辑器UEditor增加字间距工具按钮

发表于 2021-02-19 | 分类于 前端框架 , 编辑器 |
字数统计: 914 | 阅读时长 ≈ 4

百度编辑器工具栏中没有字间距工具,在编辑富文本的时候可能会用到字间距设置,这里我们来扩展一个字间距工具。

使用的百度编辑器UEditor版本为ueditor-1.4.3.3

修改语言包

中文

文件ueditor/lang/zh-cn/zh-cn.js在labelMap里面添加'letterspacing':'字间距',

1
'lineheight':'行间距','letterspacing':'字间距','edittip' :'编辑提示','customstyle':'自定义标题', 'autotypeset':'自动排版',
阅读全文 »
1…567…20
Peak Xin

Peak Xin

Always keep a learning heart.

200 日志
41 分类
116 标签
RSS
GitHub E-Mail Twitter StackOverflow GitLab Travis Gitee SegmentFault CSDN
推荐网址
  • 阮一峰的个人网站
  • 廖雪峰的官方网站
  • 韩天峰(Rango)的博客
© 2025 Peak Xin 鲁ICP备15013472号-3
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.4
本博客 由 Peak Xin 采用 知识共享 署名 4.0 国际 许可协议进行许可。
站点总访客数: 站点总访问量:
0%