又一个MySQL坑

SELECT * FROM novel where title='一间客栈(连载)' ;
SELECT * FROM novel where title='一间客栈(连载) ' ;

以上两句的查询结果是一样的
【管理员】互联网劝退师
跟你说了很多次了,用binary才是精确查询
【管理员】互联网劝退师
SELECT * FROM novel where title=binary(‘一间客栈(连载)’ );
【元婴】PHP入门到转行
要加的吗?
【分神】BlaWhickte 2017/9/20 10:56:35
没用过binary
【元婴】PHP入门到转行 2017/9/20 10:57:58
中文检索要
【管理员】互联网劝退师
不加binary,MySQL会忽略大小写和首尾空格
【渣渣】我
原来如此

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 压缩

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