- 博客(34)
- 收藏
- 关注
原创 Yao框架浏览器打开后Cannot read properties of undefined (reading ‘search‘)
Yao创建项目后浏览器打开报 undefined 错误,是因为 Yao 框架语言包的问题,只支持浏览器的【中文(简体)】【英语(美国)】,如果浏览器排第一的语言不是这两个就会出现这个错误。临时解决方案是在浏览器的【设置】->【语言】把【中文简体】或【美式英语】排第一即可。如何在代码中设置,这个我也不清楚。
2023-09-01 14:15:11
433
原创 Laravel 中间件将参数转类型
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) { $get = $request->a...
2021-09-18 09:52:28
264
原创 Laravel 模型增加不存在的字段
// 添加表中不存在的字段名,刚刚设置好的 protected $appends = ['age', 'gender']; /** * @description: 设置表中不存在的字段名 `年龄` * @param {*} * @return {*} */ public function getAgeAttribute() { return intval(date('Y')) - intval($this-...
2021-09-12 14:09:50
995
翻译 layuiAdmin源码构建问题
执行 `gulp` 时提示 `ReferenceError: primordials is not defined`,需要在 `package.json` 文件中添加 "scripts": { "preinstall": "npx npm-force-resolutions" }, "resolutions": { "graceful-fs": "^4.2.4" }
2021-05-24 15:53:32
448
原创 PHP 导出 Excel 换行不显示
php 导出 excel 换行符需用 \r\n 如果不显示换行效果,需要双击才显示的话,在设置 excel 参数中添加 # C 指列 $objPHPExcel->getActiveSheet()->getStyle('C')->getAlignment()->setWrapText(true);
2020-06-12 19:56:08
843
原创 CI3.* 获取控制器名、方法名
# 控制器名 $this->router->fetch_class(); # 方法名 $this->router->fetch_method(); 如何在自定义公共方法内调用呢? # 先在自定义方法中添加 $CI = &get_instance(); # 控制器名 $CI->router->fetch_class(); # 方法名 $CI-...
2020-03-24 17:53:03
404
原创 CI3.* 创建公共方法
创建公共方法放在 system/helpers 比如文件名为 common_helper.php 调用 $this->load->helper('common');
2020-03-24 17:41:24
299
转载 Apache 下出现 You don't have permission to access 403 错误
打开 conf/extra/httpd-vhosts.conf 将端口目录修改为 <VirtualHost *:80> ServerName localhost ServerAlias localhost DocumentRoot "${INSTALL_DIR}/www" <Directory "${INSTALL_DIR}/www/"> ...
2020-03-24 10:38:09
736
转载 公众号基本配置中设置 Token
微信公众号/开发/基本设置/填写服务器配置页面中 URL 填写自己服务器地址 Token 值为 respond.php 设置的值 respond.php 文件内容如下: <?php traceHttp(); define("TOKEN", "kiking"); $wechatObj = new wechatCallbackapi(); if (isset($_GET['ec...
2020-03-07 18:13:10
1953
翻译 JS 点击复制文本&图片
以标签内容复制,显示 html 标签,style="display:none;"的也可以复制成功 $('button').on('click', function (event) { copy($('#copy').html()); alert('复制成功'); }) function copy(str) { var save = function (e) { ...
2020-03-04 19:13:15
952
原创 Navicat 连接不上数据库
连接数据库时出现 is not allowed to connect ... 错误,是因为数据库那边没有设置权限 登录 MySQL,进去后执行 grant all PRIVILEGES on *.* to root@'%' identified by 'password'; 说明:第一个 * 表示所有库,第二个 * 表示库中所有的表,也可以指定单个的。@ 后面是 ip 地址,% 表示所...
2020-01-13 10:36:46
721
转载 yum 安装 MySQL
安装 wget 服务 yum -y install wget 下载 mysql 的 repo 源 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 安装 mysql-community-release-el7-5.noarch.rpm 包 sudo rpm -ivh mysql-community...
2020-01-12 14:10:27
248
原创 Nginx 官网下载安装
更新系统软件,安装 wget yum -y update 安装 gcc、g++ yum -y install gcc yum -y install gcc-c++ 很多时间安装成功了都是访问不了首页,多半是防火墙未关闭,关闭防火墙 关闭防火墙 安装先决条件 sudo yum -y install yum-utils 要设置 yum 存储库,新建文件 vim /et...
2020-01-12 13:36:04
2827
原创 TP5 格式化时间戳
模型查询数据时,需要将时间戳字段自动转为日期格式: class User extends Model { /** * 定义时间戳字段名 * 默认字段为:create_time, update_time * 如果是这两字段就不用再设置,不是则需要设置 */ protected $createTime = 'create_at'; ...
2020-01-10 15:32:27
2014
翻译 Laravel 6.x 使用 ajax 请求出现 419 错误
使用 Ajax 登录时,出现 419 错误: Status Code: 419 unknown status 在页面头部添加: <meta name="csrf-token" content="{{ csrf_token() }}"> 在 Ajax 请求头添加: headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-to...
2019-12-10 14:24:20
687
翻译 Linux 下安装 Redis 扩展
下载 wget http://download.redis.io/releases/redis-4.0.9.tar.gz 移动到 /usr/local 目录 cp redis-4.0.9.tar.gz /usr/local 解压 tar -zxvf redis-4.0.9.tar.gz 进目录 cd redis-4.0.9 安装到指定目录 make PREFIX=...
2019-07-15 16:20:43
185
原创 ThinkPHP、Laravel项目在 LNMP 下只能访问首页,其他方法均为404
LNMP 上各个版本 pathinfo 设置基本一样。 LNMP v1.1上,修改对应虚拟主机的配置文件,去掉 # include pathinfo.conf; 前面的 #,把 try_files $uri = 404; 前面加上 # 注释掉。 LNMP 1.2/1.3 以上,修改对应虚拟主机的配置文件,将 include enable-php.conf; 替换为 in...
2019-07-12 19:02:50
653
翻译 Linux 防火墙状态
CentOs 7 以下版本: 查看防火墙状态 service iptables status 没有安装 iptables 服务要先安装 yum -y install iptables-services 开启防火墙 service iptables start 关闭防火墙 service iptables stop 关闭开机启动 chkconfig iptables...
2019-07-08 10:50:56
232
翻译 Layui iframe版 关闭页签的同时刷新另一个页签
在列表页点击编辑的时候打开新页签 parent.layui.index.openTabsPage(url, '编辑'); 编辑完后关闭当前页签并刷新列表页 parent.layui.index.refreshAndCloseTabs(refresh, close); 注意:refreshAndCloseTabs() 方法是自定义的,需要在 lib/index.js 中添加该方法 r...
2019-07-01 14:36:03
3754
翻译 Windows 下 memcache 设置开机启动
1、在 cmd 窗口中的 memcache 安装目录下执行 memcached.exe -d install 如果出现以下错误是因为权限不足,需要管理员运行 cmd.exe 2、在服务中找到 memcached ,启动服务即可。 ...
2019-06-26 14:25:48
1203
翻译 在 Windows 下为 PHP 安装 memcache 扩展
1、查看 PHP版本信息,主要注意以下几点 PHP Version 7.0.33 Compiler MSVC14 (Visual C++ 2015) Architecture x64 Zend Extension Build API320151012,TS,VC14 PHP Extension Build API20151012,TS,VC14 2、根据 PHP 版本号,编译器版本号和 C...
2019-06-26 11:25:39
251
翻译 Windows 下 redis 设置开机启动
1、在 reids 安装目录下执行 redis-server --service-install redis.windows-service.conf --loglevel verbose 2、在服务中找到 redis 启动服务即可。 3、如果出现 1067 错误,是因为端口被占用,把 cmd 中的 redis 关闭掉即可。 ...
2019-06-26 10:56:05
237
翻译 在 Windows 下为 PHP 安装 redis 扩展
1、查看 PHP版本信息,主要注意以下几点 PHP Version 7.0.33 Compiler MSVC14 (Visual C++ 2015) Architecture x64 Zend Extension Build API320151012,TS,VC14 PHP Extension Build API20151012,TS,VC14 2、根据 PHP 版本号,编译器版本号和 C...
2019-06-25 18:25:45
372
转载 TP5 自定义跳转页面
TP5的跳转文件目录 thinkphp/tpl/dispatch_jump.tpl 这是用的是 Layui 的样式。 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport"...
2019-05-28 09:58:40
1680
2
原创 CentOS 官网下载 iso 镜像
CentOS 官网下载地址: https://www.centos.org/download/ 里面有阿里、网易、京东、华为等等,选择一个就可以下载了。
2019-03-26 11:38:51
2005
原创 MySQL 基本知识点
创建表: CREATE TABLE `table` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(32) NOT NULL DEFAULT '' COMMENT '用户名', `password` varchar(64) NOT NULL DEFAULT '' COMMENT '密码', ...
2019-03-23 20:08:31
188
原创 Navicat 导入 .txt 文件
需要导入数据库的 .txt 文件如图所示: 根据导入的txt文件创建好表: CREATE TABLE `pre_vyuan_lng_lat` ( `ll_id` int(11) NOT NULL AUTO_INCREMENT, `ll_lng` varchar(30) NOT NULL COMMENT '经度', `ll_lat` varchar(30) NOT NULL C...
2019-03-16 14:57:04
11689
3
原创 使用 Layui 模板引擎在页面中插入 JS
在 html 页面中经常有些 select 有很多的 option,而且都有规律的。比如身高、体重这些,如果一个一个写也太麻烦了,可以用到 layui 中的模板引擎。 官方文档:https://www.layui.com/doc/modules/laytpl.html <div class="layui-inline"> <label class="layui-fo...
2019-03-13 16:49:40
5156
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅