随笔分类 - PHP
摘要:下面是总结的几个使用方法include 'PHPExcel.php';include 'PHPExcel/Writer/Excel2007.php';//或者include 'PHPExcel/Writer/Excel5.php'; 用于输出.xls的创建一个excel$objPHPExcel = ...
阅读全文
摘要:今天调试一个非常老的代码时 发现nginx服务器超时 改了下nginx配置 发现是后台脚本一直等待 排查到最后发现是curl 超时引起的等待 具体解决方案: curl_setopt( $this->ch, CURLOPT_URL, $url ); curl_se...
阅读全文
摘要:语法规则: location [=|~|~*|^~] /uri/ { … }= 开头表示精确匹配^~ 开头表示uri以某个常规字符串开头,理解为匹配 url路径即可。nginx不对url做编码,因此请求为/static/20%/aa,可以被规则^~ /static/ /aa匹配到(注意是空格)。~ ...
阅读全文
摘要:很早知道ci出了2.0版本了。这几天正好有项目要用ci开发 虽然项目不大。不过也从开发项目的过程中熟悉了CI框架 因为是个电商项目 本来想用个YII2 的。 封装的虽然厉害不过功能强大 因为另个兄弟坚持所以采用了CI 开搞前特地问了下新版有没ORM(我知道老版没有- -) 被告知有了ORM 结果开...
阅读全文
摘要:Order::model()->updateAll(array('merchant_id'=>'bbb'), "id in ('140868169311','140869058428')");数据库的批量操作。
阅读全文
摘要:在控制器里$name = $this->getModule()->id; // module$name = $this->getId(); // controller$name = $this->getAction()->id; // action在视图里,除了上述2个方法还可:$name = ...
阅读全文
摘要:<?php$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP );socket_bind($socket ,'127.0.0.1', 11211 );socket_listen( $socket ,5);while( true ){ $...
阅读全文
摘要:首先说说过滤干嘛用的。这东西主要是防止XML里面嵌套HTML标签导致XML样式错乱的。过滤很简单:$response = str_replace( array( ''), array( '' ), $response );将原来的XML的<![CDATA[ 前面及后面加个空格就行了。再这样就没问题了...
阅读全文
摘要:echo strtotime(date('Y-m-d')); 获取明天凌晨的时间戳代码:echo strtotime(date('Y-m-d',strtotime('+1 day'))); 附上测试代码:echo strtotime('2012-11-2');echo strtotime('2012...
阅读全文
摘要:phpredis是php的一个扩展,效率是相当高有链表排序功能,对创建内存级的模块业务关系很有用;以下是redis官方提供的命令使用技巧:下载地址如下:https://github.com/owlient/phpredis(支持redis 2.0.4)Redis::__construct构造函数$r...
阅读全文
摘要:selectDB("banggoCMS"); //$db = $m->banggoCMS;$col = $db->dbeleComment2014;/*新增*//* $opt = array( 'fsync' => 1 //默认为 false , false时当日志配置开启时和 j...
阅读全文
摘要:function getNext( $str ){ $ret = array(0=>0); for( $j =1; $j $l2) return $rt; $i = $p; $j = 0; $next = getNext($sstr); whil...
阅读全文
摘要:nginx是一个web服务器,因此nginx的access日志只有对访问页面的记录,不会有php 的 error log信息。nginx把对php的请求发给php-fpm fastcgi进程来处理,默认的php-fpm只会输出php-fpm的错误信息,在php-fpm的errors log里也看不到...
阅读全文
摘要:$filename = 'D://WWW/1.jpg';$p = 5;// Get new sizeslist($width, $height) = getimagesize($filename);$newwidth = $width;$newheight = floor($height / $p)...
阅读全文
摘要:$ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt(...
阅读全文
摘要:url = $url; $this->ch = curl_init(); $this->type = $type; } //设置发送方式 0 get 1 post public function setType( ...
阅读全文
摘要:php switch($_GET['do']){ case 'vc': $cookieFile = "./test.tmp"; $url = 'http://localhost/test/login.php?do=vcode&?r='.rand(); $ch = curl_init($url); ...
阅读全文
摘要:"; }else{ $dirname = $basedir."/". $file; checkdir($dirname); } } } closedir($dh); } } function checkBOM ($filename) { global $auto; $contents = file...
阅读全文
摘要:php /** *@author:xiaojiang 20140222 * 一致性哈希php 实现 */ class MyHash{ //虚拟节点数 private $_virtualCounts = 2; //虚拟节点集合 private $_circleItems = array(); //实...
阅读全文

浙公网安备 33010602011771号