名字 :
月度归档:2017年09月
uglifyjs 压缩下js文件
1. 安装
npm install uglify-js -g
2. 单文件压缩
uglifyjs .\u17.js -o u17.min.js
3. 谁教下我怎么混淆?
Twig 快速集成
假设你的项目项目使用composer
1. 安装,为了兼容php5.4使用的是1.x版本
composer require twig/twig:~1.0
2. 封装为trait以集成
namespace objects\Traits; trait DoufuTwig { /** * @var \Twig_Environment */ private $twig; protected function renderTwig($path, $data = []) { if (! $this->twig) { $loader = new \Twig_Loader_Filesystem(APPPATH . 'views'); $this->twig = new \Twig_Environment($loader, array( 'cache' => APPPATH . 'cache', 'auto_reload' => true )); } return $this->twig->render($path, $data); } }
3. 使用
集成到控制器父类
namespace Ncontrollers; use objects\Traits\DoufuTwig; abstract class Controller { use DoufuTwig; }
控制器内使用
... echo $this->renderTwig('xxx/login.html'); ...
xtrabackup 快速增量备份教程
xtrabackup –backup –compress –target-dir=/mysqlbackup/full –user=aaa –host=hostname –password=xxxx –databases=ggggg
xtrabackup –backup –compress –target-dir=/mysqlbackup/incr –incremental-basedir=/mysqlbackup/full –user=aaa –host=hostname –password=xxxx –databases=ggggg
–compress 压缩
Error Code: 1503. A PRIMARY KEY must include all columns in the table’s partitioning function
Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set ‘always_populate_raw_post_data’ to ‘-1’ in php.ini and use the php://input stream instead.
<br />
<b>Deprecated</b>: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set ‘always_populate_raw_post_data’ to ‘-1’ in php.ini and use the php://input stream instead. in
<b>Unknown</b> on line
<b>0</b>
<br />
<br />
<b>Warning</b>: Cannot modify header information – headers already sent in
<b>Unknown</b> on line
<b>0</b>
<br />
edit php.ini and set always_populate_raw_post_data = -1
; Always populate the $HTTP_RAW_POST_DATA variable. PHP’s default behavior is
; to disable this feature and it will be removed in a future version.
; If post reading is disabled through enable_post_data_reading,
; $HTTP_RAW_POST_DATA is *NOT* populated.
; http://php.net/always-populate-raw-post-data
always_populate_raw_post_data = -1
MySQL 搜索 emoji 表情匹配错误问题
令人无语bug,你猜得没错是编码问题我的编码是utf8mb4_unicode_ci,这是laravel的默认编码啊,解决办法是使用 utf8mb4_bin 即可。。。。
奇异的setcookie无效问题
api.xxxx.com/aaa 页面下setcookie,
api.xxxx.com/xxx,cookie 有效
api.xxxx.com/index.php/xxx,cookie 无效
其实是cookie path的问题
setcookie($key, $value, null, ‘/’, null, null);