PHP 一些类型对应的 bool 值

小测试……

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var_dump(false, !!false);
// bool(false) bool(false)

var_dump(null, !!null);
// NULL bool(false)

var_dump(0, !!0);
// int(0) bool(false)

var_dump(1, !!1);
// int(1) bool(true)

var_dump('', !!'');
// string(0) "" bool(false)

var_dump(' ', !!' ');
// string(1) " " bool(true)

var_dump(array(), !!array());
// array(0) { } bool(false)

var_dump(array(''), !!array(''));
// array(1) { [0]=> string(0) "" } bool(true)

CentOS - phpMyAdmin的安装

安装phpMyAdmin

1
sudo yum install phpmyadmin

phpMyAdmin 连接阿里云 RDS

sudo vi /etc/phpMyAdmin/config.inc.php 修改$cfg['Servers'][$i]['host']的值

1
2
3
4
5
6
7
8
// The $cfg['Servers'] array starts with $cfg['Servers'][1].  Do not use
// $cfg['Servers'][0]. You can disable a server config entry by setting host
// to ''. If you want more than one server, just copy following section
// (including $i incrementation) serveral times. There is no need to define
// full server array, just define values you need to change.
$i++;
$cfg['Servers'][$i]['host'] = 'xxxx.mysql.rds.aliyuncs.com'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port

PHP Bookmarks

HandBook

Git - Please tell me who you are.

解决方案

1
git config --global user.email "you@example.com"

Xcode 下本地文件一键同步到服务端

新建工程

Xcode--New--Project--OS X--Other--External Build System

PHP Date() 函数

小测试……

1
2
3
4
5
6
7
8
9
date("Y-m-d"); // 2015-02-10

$now = microtime(TRUE);
date("Y-m-d", $now); // 2015-02-10
date("Y-m-d", $now - 60 * 60 * 24); // 2015-02-09

mktime(hour, minute, second, month, day, year)
$t = mktime(13, 2, 3, 2, 10, 2015);
date("Y-m-d H:i:s", $t); // 2015-02-10 13:02:03

磁盘空间常用命令

磁盘空间常用命令

1
2
3
df -h   #磁盘剩余空间
du -sh #当前目录总大小
du --max-depth=1 -h #当前目录空间使用情况

php 获取当前时间的错误

之前一直用这个方法获取当前时间:

1
$now = new DateTime();

Linux Bookmarks

Common