php设计模式之策略模式简单事例 程序积累
<?php //策略模式 interface OutputInterface { public function load($arrayOfData); } class SerializedArrayOutput implements OutputInterface { public fun...
<?php //策略模式 interface OutputInterface { public function load($arrayOfData); } class SerializedArrayOutput implements OutputInterface { public fun...
<?php //单例模式 class Singleton { /** * @var 这个类的"单例" */ private static $instance; /** * 防止在这个类之外new这个类 */ private functio...
<?php //工厂模式 class Automobile { private $vehicleMake; private $vehicleModle; public function __construct($make,$model) { $this->...
vim mysql.sh #!/bin/bash host='127.0.0.1' user='root' passwd='root' dbname='test' test_sql='select count(*) from test' num=$(mysql -s -h$host -u$user -p$p...
启动php-fpm: /usr/local/php/sbin/php-fpm php-fpm需要使用信号控制,master进程可以理解以下信号 INT, TERM 立刻终止 QUIT 平滑终止 USR1 重新打开日志文件 USR2 平滑重载所有worker进程并重新载入配置和二进制模块 重启方法...
vim test.sh #!/bin/bash step=1 #间隔的秒数,不能大于60 for (( i = 0; i < 60; i=(i+step) )); do $(/work/software/php/bin/php '/work/www/live/test.php') ...
<?php /** * $m 猴子总数 * $n 出局数 */ function king($m,$n){ $arr = range(1, $m); $i = 0; while (count($arr)>1) ...
redis查看当前redis-server启动使用的配置文件 redis-cli info | grep config
今天用rockmongo打开一个集合的时候提示 Cannot natively represent the long 1476355233494 on this platform 解决办法 在index.php中加入 ini_set('mongo.long_as_object', 1);
有个需求,要把java代码里面的jzip压缩方法还原成php java jzip压缩代码如下 /*** * 压缩GZip * * @param data * @return */ public static byte gZip(byte data) { ...