邀请码 678082
####编译前执行下列命令####
#添加组
groupadd www
#添加php-fpm用户
useradd -c php-fpm-user -g www -M php-fpm
# c和c++编译器
yum install -y gcc gcc-c++
我刚才想到一点,感觉应该可能是造成我困扰的主要原因 就是我把hash算法和hash表索引算法想成一个东西了 hash算法:time33等, hash表索引算法:h & ht->tTableMask,或者 h % 32 哈希算法的结果是h, h & ht->tTableMask的结果是元素在hash表中的位置
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$w = array('a' =>1, 'b'=>10, 'c'=>14, 'e'=>20, 'f'=>30, 'h'=>6, 'g'=>70); | |
function roll($weight) | |
{ | |
$sum = array_sum($weight); | |
$j = 0; | |
foreach($weight as $k=>$v) | |
{ | |
$j = mt_rand(1,$sum); | |
if($j <= $v) |
学会用strace:
strace -o php.log -s 65535 php -i
然后在 php.log 中找ini:
open("/usr/bin/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/php.ini", O_RDONLY)
##PHP 5.4新特性##
掌握
- traits
trait的引入,可以扩展class的内容,使class在某种形式上实现了多重继承,更加灵活,trait不能被实例化 举个例子,假设有三个类,男人,女人,人,人是男人和女人的父类,双11购物不是人人都有的行为,放在人 这个父类里显然不合适,我们把双11购物单独定义为一个trait,这个双11购物的trait不能自己驱动,需要被 其他类引用,从而让引用trait的类具有购物行为
示例代码:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./configure \ | |
--prefix=/home/liwh/program/php-5.5.5\ | |
--enable-fpm\ | |
--with-fpm-user=php-fpm\ | |
--with-fpm-group=php-fpm\ | |
--enable-opcache\ | |
--enable-calendar\ | |
--enable-exif\ | |
--enable-ftp\ | |
--enable-gd-native-ttf\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 普通匹配,遵循最长匹配规则,假设一个请求匹配到了两个普通规则,则选择匹配长度大的那个 | |
例如: | |
location /{ | |
[matches] | |
} | |
location /test{ | |
[matches] | |
} | |
2 精确匹配 | |
location = /{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
NewerOlder