[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
#248
#249
cd/ e: cd Php-project\jxt\view\group npm run dev pause#250
cd/ e: cd test1/test2#251
<el-upload class="avatar-uploader el-upload--text" :action="uploadUrl" :show-file-list="false" :on-success="handleVideoSuccess" :before-upload="beforeUploadVideo" :on-progress="uploadVideoProcess">uploadVideoProcess(event, file, fileList){ this.videoFlag = true; this.videoUploadPercent = file.percentage.toFixed(0); },#252
<el-upload class="upload-demo" action="#" ref="upimg" :on-success="handleAvatarSuccess" :on-progress="uploadVideoProcess" :http-request="httpRequestLogo" :limit="1" > <el-button size="mini" type="primary">点击上传</el-button> <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> --> </el-upload>handleAvatarSuccess(res, file) { //console.log(213); // this.myData= file; this.$refs.upimg.clearFiles(); //上传成功之后清除历史记录 //this.handleInitTableData(); //初始化表格数据 }, /*uploadVideoProcess(event, file, fileList){ console.log(file.percentage.toFixed(0)); },*/ // 图片上传 httpRequestLogo(file) { if('' === this.categoryprice) { return this.$message.error('请选择图片分类') } let formdata = new FormData() formdata.append('file',file.file) formdata.append('name',file.file.name) formdata.append('categoryId', this.categoryprice) this.loading=true; const config = { onUploadProgress: progressEvent => { // progressEvent.loaded:已上传文件大小 // progressEvent.total:被上传文件的总大小 let progressPercent = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2)) if(progressPercent>99) this.loading=false; this.progressPercent=progressPercent; //console.log(progressPercent); } } this.$http.post('/image/upload', formdata,config).then(({ data: res }) => { console.log(res) if(1 !== res.code) { return this.$message.error(res.msg) } this.$message.success('上传成功') this.handleAvatarSuccess() this.getDataList() }) },#253
chmod 777 项目文件夹/node_modules/.bin/vue-cli-service#254
<!--配置文件 value: //编辑器内容 config:{ eddc:{ //其他 }, toolbars:[ //工具栏] } editorNum: 1 //编辑器编号 width: 75% width1: 380px --> <template> <!--<script id="editor" type="text/plain"></script>--> <div> <div :id="'editor'+editorNum"></div> <JxtPicture :exhibition="exhibition" @close="onClose" :title="'图片管理'" @getImg="getImg" :width="'75%'" :width1="'380px'" :priceLength="10000" v-if="exhibition" ></JxtPicture> </div> </template> <script> import JxtPicture from '../components/jxt-picture.vue' export default { name: 'ue1', components: { JxtPicture }, props: { editorNum:{ type: Number, default:1 //编辑器编号 }, value: { type: String, default: '', required: false }, config: { type: Object, default: { eddc:{}, toolbars:[] }, required: false }, }, data() { return { exhibition:false, editor: null, instance: null, //texta: 333, configd:this.config, eddc:{ initialFrameWidth:null ,//宽度随浏览器自适应 wordCount: false, //关闭字数统计 elementPathEnabled : false,//隐藏元素路径 autoHeightEnabled: true,//是否自动长高 autoFloatEnabled: true,//是否保持toolbar的位置不动 initialFrameHeight: 360, }, toolbars: [[ 'source', //源代码 //'anchor', //锚点 'undo', //撤销 'redo', //重做 '|', 'forecolor', //字体颜色 'backcolor', //背景色 'bold', //加粗 //'indent', //首行缩进 //'snapscreen', //截图 'italic', //斜体 'underline', //下划线 'strikethrough', //删除线 'subscript', //下标 'fontborder', //字符边框 'superscript', //上标 '|', 'formatmatch', //格式刷 //'blockquote', //引用 'pasteplain', //纯文本粘贴模式 'selectall', //全选 //'print', //打印 //'preview', //预览 'horizontal', //分隔线 'removeformat', //清除格式 '|', //'time', //时间 //'date', //日期 //'unlink', //取消链接 'insertrow', //前插入行 'insertcol', //前插入列 'mergeright', //右合并单元格 'mergedown', //下合并单元格 'deleterow', //删除行 'deletecol', //删除列 'splittorows', //拆分成行 'splittocols', //拆分成列 'splittocells', //完全拆分单元格 'deletecaption', //删除表格标题 'inserttitle', //插入标题 'mergecells', //合并多个单元格 'deletetable', //删除表格 'cleardoc', //清空文档 //'insertparagraphbeforetable', //"表格前插入行" //'insertcode', //代码语言 //'fontfamily', //字体 '|', 'fontsize', //字号 'paragraph', //段落格式 //'simpleupload', //单图上传 //'insertimage', //多图上传 //'edittable', //表格属性 //'edittd', //单元格属性 //'link', //超链接 //'emotion', //表情 //'spechars', //特殊字符 //'searchreplace', //查询替换 //'map', //Baidu地图 //'gmap', //Google地图 //'insertvideo', //视频 //'help', //帮助 '|', 'justifyleft', //居左对齐 'justifyright', //居右对齐 'justifycenter', //居中对齐 'justifyjustify', //两端对齐 '|', 'insertorderedlist', //有序列表 'insertunorderedlist', //无序列表 //'directionalityltr', //从左向右输入 //'directionalityrtl', //从右向左输入 //'rowspacingtop', //段前距 //'rowspacingbottom', //段后距 'pagebreak', //分页 'insertframe', //插入Iframe '|', 'imagenone', //默认 'imageleft', //左浮动 'imageright', //右浮动 //'attachment', //附件 'imagecenter', //居中 //'wordimage', //图片转存 'lineheight', //行间距 //'edittip ', //编辑提示 //'customstyle', //自定义标题 //'autotypeset', //自动排版 //'webapp', //百度应用 //'touppercase', //字母大写 //'tolowercase', //字母小写 //'background', //背景 //'template', //模板 //'scrawl', //涂鸦 //'music', //音乐 'inserttable', //插入表格 //'drafts', // 从草稿箱加载 'charts', // 图表 '|', 'fullscreen', //全屏 'macros', // 自定义上传 ]] } }, watch: { value: { handler: function(val, oldVal) { this.editor = window.UE.getEditor('editor'+this.editorNum, this.configd); this.editor.setContent(val); } } }, mounted () { let config=this.config; //console.log(config.eddc);return false; let eddc=config.eddc && Object.keys(config.eddc).length!=0?config.eddc:this.eddc let toolbars=config.toolbars && config.toolbars.length && config.toolbars[0] && config.toolbars[0].length ?config.toolbars:this.toolbars //console.log(eddc); eddc.toolbars=toolbars; console.log(eddc) this.configd=eddc; this.$nextTick(() => { const _this = this this.editor = window.UE.getEditor('editor'+this.editorNum, this.configd); this.editor.addListener('ready', function () { _this.editor.setContent(_this.value) }) this.editor.commands['macros'] = { execCommand : () => { this.beforeInsertImage() }, queryCommandState: function(){ } } }) }, methods: { onClose() { this.exhibition = false }, getUEContent () { return this.editor.getContent() }, beforeInsertImage() { //this.$emit('showModal', { editor: 'editor' }) //console.log(e) this.exhibition = true //this.priceLength = 10000 }, getImg(e) { let UE = this.editor e.forEach(item => { UE.execCommand('insertHtml', `<img src=${item.org_img}>`) }) }, }, destroyed () { this.editor.destroy() } } </script> <style lang="scss" scoped> /*#editor { width: 90vh; }*/ </style>#255
UEditor自定义toolbar工具条
使用ueditor的同学都知道,ueditor里有很多功能,
很全面,但有时候我们的编辑器不需要太多的功能,比如前台评论或者留言,就不需要这么多功能了,
那我们怎么去定制自己想要的工具呢?
官方给出了两个方法,
ueditor工具栏上的按钮列表可以自定义配置,
只需要通过修改配置项就可以实现需求:
1. 方法一:修改ueditorconfig.js里面的toolbars
2. 方法二:实例化编辑器的时候传入toolbars参数
第一种貌似不适合,需要改ueditor.config.js文件,有点麻烦,
第二种就很好,我们且来看看第二种方法,示例如下:
<script type="text/javascript" src="ueditor/ueditor.config.js"></script> <script type="text/javascript" src="ueditor/ueditor.all.min.js"> </script> <script type="text/javascript" src="ueditor/lang/zh-cn/zh-cn.js"></script> <script> $(function() { //本来是这样的:UE.getEditor('editor'); 传入参数后就是下面那样子了,toolbars里的就是工具的图标 UE.getEditor('editor', { toolbar: [ ['fullscreen', 'source', 'undo', 'redo', 'bold', 'italic', 'underline','fontborder', 'backcolor', 'fontsize', 'fontfamily', 'justifyleft', 'justifyright','justifycenter', 'justifyjustify', 'strikethrough','superscript', 'subscript', 'removeformat', 'formatmatch','autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor','insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', 'link', 'unlink','emotion', 'help'] ] }); }) </script>配置项里用竖线
'|'完整的按钮列表
toolbars: [ [ 'anchor', //锚点 'undo', //撤销 'redo', //重做 'bold', //加粗 'indent', //首行缩进 'snapscreen', //截图 'italic', //斜体 'underline', //下划线 'strikethrough', //删除线 'subscript', //下标 'fontborder', //字符边框 'superscript', //上标 'formatmatch', //格式刷 'source', //源代码 'blockquote', //引用 'pasteplain', //纯文本粘贴模式 'selectall', //全选 'print', //打印 'preview', //预览 'horizontal', //分隔线 'removeformat', //清除格式 'time', //时间 'date', //日期 'unlink', //取消链接 'insertrow', //前插入行 'insertcol', //前插入列 'mergeright', //右合并单元格 'mergedown', //下合并单元格 'deleterow', //删除行 'deletecol', //删除列 'splittorows', //拆分成行 'splittocols', //拆分成列 'splittocells', //完全拆分单元格 'deletecaption', //删除表格标题 'inserttitle', //插入标题 'mergecells', //合并多个单元格 'deletetable', //删除表格 'cleardoc', //清空文档 'insertparagraphbeforetable', //"表格前插入行" 'insertcode', //代码语言 'fontfamily', //字体 'fontsize', //字号 'paragraph', //段落格式 'simpleupload', //单图上传 'insertimage', //多图上传 'edittable', //表格属性 'edittd', //单元格属性 'link', //超链接 'emotion', //表情 'spechars', //特殊字符 'searchreplace', //查询替换 'map', //Baidu地图 'gmap', //Google地图 'insertvideo', //视频 'help', //帮助 'justifyleft', //居左对齐 'justifyright', //居右对齐 'justifycenter', //居中对齐 'justifyjustify', //两端对齐 'forecolor', //字体颜色 'backcolor', //背景色 'insertorderedlist', //有序列表 'insertunorderedlist', //无序列表 'fullscreen', //全屏 'directionalityltr', //从左向右输入 'directionalityrtl', //从右向左输入 'rowspacingtop', //段前距 'rowspacingbottom', //段后距 'pagebreak', //分页 'insertframe', //插入Iframe 'imagenone', //默认 'imageleft', //左浮动 'imageright', //右浮动 'attachment', //附件 'imagecenter', //居中 'wordimage', //图片转存 'lineheight', //行间距 'edittip ', //编辑提示 'customstyle', //自定义标题 'autotypeset', //自动排版 'webapp', //百度应用 'touppercase', //字母大写 'tolowercase', //字母小写 'background', //背景 'template', //模板 'scrawl', //涂鸦 'music', //音乐 'inserttable', //插入表格 'drafts', // 从草稿箱加载 'charts', // 图表 ] ]备注:
我配置的时候配置key使用的是toolbar,
很多博文使用的是toolbars,但是我使用toolbars不起作用,
不知道是不是ueditor的版本问题。
<!-- 加载编辑器的容器 --> <script id="editor" type="text/plain" name="content"> ${info.content} //在这里输入编辑器的初始内容。 </script> <!-- 创建编辑器并设置属性 --> <script type="text/javascript"> //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例 //相见文档配置属于你自己的编译器 var ue = UE.getEditor('editor', { initialFrameHeight: 300, initialFrameWeight: 100 }); </script>#256
#257
ThinkPHP5有关联模型的操作,
但有部分初学者对数据表中常见的几种表与表的关系还存在着问题,
所以使用不好关联查询。
这里将hasOne、hasMany、belongsTo进行一个详细举例说明。
首先,这3个的大致中文意思:
hasOne:有一个,加上主谓语应该是 ,A 有一个 B hasMany:有很多,A 有很多 B belongsTo:属于, A 属于 B这里我们准备3张表来理解他们的关系:
user_group 用户分组表:id、title
user 用户表:id、user_group_id、username、password
profile 用户信息表:id、user_id、nickname、sex
1、user表需要关联user_group表,表示每一个 用户 需要知道该用户是 哪个用户分组的;
2、profile表 需要关联 用户表,表示该用户信息数据 是哪个用户的信息;
我们知道一个用户组下面可以有很多用户,
所以:user_group hasMany user;
一个用户 属于 一个用户组,
所以:user belongsTo user_group;
同样是user_group和user表,但我们出发点不同,关系也就不一样了。
每个用户都应该有唯一一条用户信息数据,
所以:user hasOne profile;
一条用户信息 属于 一个用户,
所以:profile belongsTo user
综上:
在User模型中,我们可以定义关联:
function user_group(){ return $this->belongsTo('UserGroup'); } function profile(){ return $this->hasOne('Profile'); }我们在查询中:
$user = model('User')->find(); $user = $user->user_group; //这样user中就可以包含当前数据对应的user_grou数据了 $user = $user->profile;//这样user中就可以包含当前数据对应的profile数据了在UserGroup模型中,我们可以定义关联:
function user(){ return $this->hasMany('User'); }在Profile模型中,我们可以定义关联:
function user(){ return $this->belongsTo('User'); }注:定义关联function的方法名可以随意定义,一般为表名或模型名;
我们定义的时候是function,但获取时理解为获取属性,所以不加();
很多人理解是我定义了一个profile的方法,
所以应该$user->profile(),这里要特别注意下。
这样我们在查询时,就方便了,不需要使用大量的join。
#258
#259
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <p onclick="ky();">跨域</p> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"> </script> <script> function ky(){ $.ajax({ type: "POST", url:'http://group.jxttest.com/v1/articles/catsLists', error: function(request) { console.log('失败:'+request); }, success: function(data) { console.log('成功:'+data); } }); } </script>#260
将 C:\Users\Administrator\AppData\Roaming 目录下Docker目录改名为Docker_backup(实际上就是删除并备份),
启动 Docker for windows.exe,提示docker没有启动,
点击启动docker一切恢复如初,原来的容器和镜像都在。
#261
mysql 报错[Err] [Dtf] 1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'uploadtime' at row 9 With statement:......
搜索之后发现原来是因为 msyql5.7 及以上不允许时间戳字段插入 ‘0000-00-00’ 数据,
修复方法也比较简单,去掉sql_model 中的 NO_ZERO_DATE 配置即可
查看可以执行SQL
select @@global.sql_mode;修改方法有好几个,
最简单的就是执行SQL
set @@global.sql_mode = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';还有一个修改配置文件
vim /etc/my.cf //添加这条数据 sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION保存退出后重启mysql
set @@GLOBAL.sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION;需修改mysql配置文件,
通过手动添加sql_mode的方式强制指定不需要ONLY_FULL_GROUP_BY属性,
my.cnf位于etc文件夹下,vim下光标移到最后,添加如下:
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION重启mysql服务
#262
SQLSTATE[HY000] [2002] Connection refused
使用docker搭建lnmp环境,使用的是分容器的搭建方案
框架使用thinkphp,想要连接数据MySQL,一直显示“SQLSTATE[HY000] [2002] Connection refused”
数据库配置host填的是localhost,后面改成了127.0.0.1,都是连接不了
还以为是数据库用户权限问题,
新建了一个用户,刷新了权限,结果还是不行
想了好久,原来都是分容器的问题,
由于采用了分容器的搭建方案,
在php的容器内连接127.0.0.1或者localhost,肯定是连接不了数据库MySQL的
应该把数据库配置host填成MySQL容器名称,
我本地的MySQL容器名称为mysql,
改成这样就可以连接
<?php return [ // 数据库类型 'type' => 'mysql', // 服务器地址 'hostname' => 'mysql', // 数据库名 'database' => 'jxt', // 用户名 'username' => 'root', // 密码 'password' => '123456', // 端口 'hostport' => '3306',#263
location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } }tp3.2 nginx 伪静态
location / { if (!-e $request_filename) { rewrite ^/index.php(.*)$ /index.php?s=$1 last; rewrite ^(.*)$ /index.php?s=$1 last; #rewrite ^(.*)$ /index.php$1 break; break; } }server { listen 80; server_name tp tp.com tp.net tp.org www.tp.com www.tp.net www.tp.org; root /www/root/develop/tp/Public; charset UTF-8; location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php?s=/$1 last; } index index.php; } include php; include error; }#264
进入数据库内部
mysql -u root -p book查看当前字符集
show variables like '%character%';解决方法:
修改my.ini配置文件
my.ini中查找sql-mode
我的MySQL版本为Server version: 5.6.47 MySQL Community Server (GPL)
默认为:sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
将STRICT_TRANS_TABLES,删掉保存重启mysql
如果版本高的话默认可能是:
sql_mode="STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER
将NO_ZERO_DATE,NO_ZERO_IN_DATE,删掉保存重启mysql即可
#265
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
分析:
根据异常信息分析能发现,这个问题主要是由于sql_mode引起,所以先查看sql_mode后修改即可,主要是去除only_full_group_by
解决方案:
方案一:只修改当前数据库的SQL_MODE
-- 查看SQL_MODE
SELECT @@sql_mode;-- 修改SQL_MODE
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));方案二:修改配置文件my.ini
-- 查看数据库的存储地址
SELECT @@datadir -- D:\MySQL\mysql-5.7.17-winx64\data\打开对应的地址,找到my.ini,添加
[mysql] sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION#266
因为公司不同项目采用了不同的代码规范,而且彼此不兼容,为了方便同事开发,
将不同项目的PhpStorm Code Style配置以文件方式落地存储并提交代码库,方便共享和维护。
操作方式:
PhpStorm Menu > Preferences... > Editor > Code Style,
右侧 Scheme选择Project,这时可以点击右侧的Set from...引入现成的配置,也可以手动调整配置,完成后退出
将项目根目录下的 .idea/codeStyleSettings.xml文件提交到代码库即可
以上两步重复在不同的项目中操作,即可将不同项目配置分别提交到对应代码库,
同事拉去后即可在不同代码库启用不同的Code Style配置了