apache启动不了, 查找错误
摘要:今天apache启动不了, 本来以为是端口冲突, 用 cmd-> netstat -aon|findstr "80" 或 tasklist|findstr "80" 命令查了一下, 发现没有程序监听80端口, 于是就怀疑是apache自身出了问题, 于是网上搜了下, 无从下手, 就cmd 进入apache的bin目录下面运行 cmd->httpd 可以查看错误所在, 最终一步一步的修改成功!
阅读全文
posted @
2014-03-26 10:58
FreeSpider
阅读(333)
推荐(0)
建设银行网上银行MD5withRSA php版
摘要:1. 首先通过java程序将建设银行的公钥串转成pem格式并写入文件SignTest.java是运行程序, RSASig.java是建设银行签名算法类, bcprov-jdk15-145.jar是PEMWriter类库2. php程序做签名验证
阅读全文
posted @
2014-03-25 15:59
FreeSpider
阅读(2561)
推荐(0)
php curl常见错误:SSL错误、bool(false)
摘要:在命令行中使用curl调用跳过SSL证书检查的方法,需要的朋友可以参考下。症状:php curl调用https出错排查方法:在命令行中使用curl调用试试。原因:服务器所在机房无法验证SSL证书。解决办法:跳过SSL证书检查。curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);症状:php curl调用curl_exec返回bool(false),命令行curl调用正常。排查方法:var_dump(curl_error($ch));返回:string(23) "Empty reply from server"再排查:curl_se
阅读全文
posted @
2014-03-25 12:07
FreeSpider
阅读(513)
推荐(0)
php使用curl库进行ssl双向认证
摘要:官方文档:http://www.php.net/manual/zh/function.curl-setopt.php#10692官方举例:由于业务原因,后台登陆需要使用SSL双向认证,即web服务器有证书,浏览器客户端也需要安装证书然后这样的话,php接口文件就需要走443端口来访问了直接附上代码: /** * @name ssl Curl Post数据 * @param string $url 接收数据的api * @param string $vars 提交的数据 * @param int $second 要求程...
阅读全文
posted @
2014-03-25 12:04
FreeSpider
阅读(32863)
推荐(0)
html5 filereader 读取图片信息
摘要:简单的html5 File测试 for pic2base64
阅读全文
posted @
2014-03-24 18:40
FreeSpider
阅读(6950)
推荐(0)
php 验证类
摘要:63 || strlen($aDomain[0]) = 0x80) { if ((ord($sInBuf{$i}) >= 0x81 && ord($sInBuf{$i}) = 0x40 && ord($sInBuf{$i + 1}) 0x7E && ord($sInBuf{$i + 1}) 0xA0 && ord($sInBuf{$i}) < 0xAA) {//有中文标点 return FALSE; } } else {//有日文或其它文字 ...
阅读全文
posted @
2014-03-12 10:55
FreeSpider
阅读(2796)
推荐(0)
Yii框架操作数据库的几种方式与mysql_escape_string
摘要:一、Yii操作数据库的几种选择1,PDO方式。$sql = "";//原生态sql语句xx::model()->dbConnection->createCommand($sql)->execute();2,Active Record方式(1)New$post=new Post;$post->title='sample post';$post->content='post body content';$post->save();(2)Criteria方式也可以使用 $condition 指定更复杂的查询条件。
阅读全文
posted @
2014-02-24 17:17
FreeSpider
阅读(3580)
推荐(0)
php获取某年某月的天数
摘要:function days_in_month($month, $year) { // calculate number of days in a month return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31); }
阅读全文
posted @
2014-02-12 14:24
FreeSpider
阅读(2961)
推荐(0)
Yii中利用filters来控制访问
摘要:filters()方法定义在CController里,用Gii生成Controller时里面就有filters方法,代码如下:public function filters(){ // return the filter configuration for this controller, e.g.: return array( 'inlineFilterName', array( 'class'=>'path.to.FilterClass', 'propertyName'=>'propertyValue
阅读全文
posted @
2013-12-25 11:03
FreeSpider
阅读(8020)
推荐(0)
Yii中使用RBAC完全指南
摘要:开始准备Yii提供了强大的配置机制和很多现成的类库。在Yii中使用RBAC是很简单的,完全不需要再写RBAC代码。所以准备工作就是,打开编辑器,跟我来。设置参数、建立数据库在配置数组中,增加以下内容:‘components‘ => array(//……‘authManager‘=>array(‘class‘=>‘CDbAuthManager‘,//认证类名称‘defaultRoles‘=>array(‘guest‘),//默认角色‘itemTable‘ => ‘pre_auth_item‘,//认证项表名称‘itemChildTable‘ => ‘pre_a
阅读全文
posted @
2013-12-23 16:21
FreeSpider
阅读(634)
推荐(0)
自动把\r\n 替换成<p></p>
摘要:function nl2p($string, $line_breaks = true, $xml = true){ // Remove existing HTML formatting to avoid double-wrapping things $string = str_replace(array('', '', '', ''), '', $string); // It is conceivable that people might still want single line-breaks // with
阅读全文
posted @
2013-12-17 09:28
FreeSpider
阅读(3685)
推荐(0)
统计汉字
摘要:$str="hello world 你好世界~"; $num = preg_match_all("/[a-zA-Z]/",$str,$words); echo $num; print_r($words); $num = preg_match_all("/[\xB0-\xF7][\xA1-\xFE]/",iconv('UTF-8','GBK',$str),$words);
阅读全文
posted @
2013-12-17 09:25
FreeSpider
阅读(136)
推荐(0)
php执行linux函数
摘要:function B(){ if(defined('LOCK') && LOCK == 'lock') return false; $addPort = sprintf('-A INPUT -p tcp -m tcp --dport %d -j ACCEPT%s',PORT,PHP_EOL); //确定是否是centos if(is_file('/etc/redhat-release')){ //添加防火墙设置 $iptables = file('/etc/sysconfig/iptables');
阅读全文
posted @
2013-12-15 23:00
FreeSpider
阅读(370)
推荐(0)
PHP截取中文不乱吗
摘要:function utf_substr($str, $len){ for ($i = 0; $i 127) { $i++; if ($i < $len) { $new_str[] = substr($str, 0, 3); $str = substr($str, 3); } } else { $new_str[] = substr($str, 0, 1); $str = substr($str, 1); ...
阅读全文
posted @
2013-12-12 20:41
FreeSpider
阅读(391)
推荐(0)
php HTTP请求
摘要:function request($host){ $url = parse_url($host); $port = !empty($url['port']) ? $url['port'] : 80; $query = !empty($url['query']) ? sprintf('?%s', $url['query']) : null; $path = !empty($url['path']) ? $url['path'] : '/index.php'; $requ
阅读全文
posted @
2013-12-10 17:08
FreeSpider
阅读(531)
推荐(0)
一个压缩算法 可以适当的用来编码
摘要:function encode($string) { $dict = array_flip(range("\0", "\xFF")); $dict_size = 256; $word = $string[0]; $dict_count = 256; $bits = 8; $bits_max = 256; $return = ""; $rest = 0; $rest_length = 0; for ($i = 1, $j = strlen($string); $i $bits_max) { $bits_...
阅读全文
posted @
2013-12-07 16:38
FreeSpider
阅读(243)
推荐(0)
YII 自带验证码实现
摘要:共三步,分别controllers,models,views各一层添置一行代码即可实现 第一步在controllers添加 public function actions() {return array( 'captcha' =>array('class' => 'CCaptchaAction','backColor' => 0xF5F5F5,'transparent'=>true,'minLength'=>4, //最短为4位'maxLength'=&
阅读全文
posted @
2013-12-04 15:16
FreeSpider
阅读(629)
推荐(0)
Yii 引入js css jquery 执行操作
摘要:在布局中引用通用到js,或者css:clientScript->registerCoreScript('jquery');?> //注意这个将会插到标签上..所以title标签要放在head文档顶部防止.jquery没有第一个加入在view中引用单独的js,css这样做:$cs=Yii::app()->clientScript;//引入本地站点$cs->registerScriptFile(Yii::app()->baseUrl . '/js/star-rating/jquery.rating.pack.js', CClientSc
阅读全文
posted @
2013-12-04 14:17
FreeSpider
阅读(318)
推荐(0)
YII cookie和session的使用方法
摘要:设置cookie://首先新建cookie$cookie = new CHttpCookie(‘mycookie’, ‘this is my cookie’);//定义cookie的有效期$cookie->expire = time()+60*60*24*30; //有限期30天//把cookie写入cookies使其生效Yii::app()->request->cookies['mycookie']=$cookie;注意:CHttpCookie定义的cookie名”mycookie”与Yii::app()->request->cookies[
阅读全文
posted @
2013-12-04 14:14
FreeSpider
阅读(2418)
推荐(0)