随笔分类 -  PHP

30个php操作redis常用方法代码例子
摘要:redis的操作很多的,以前看到一个比较全的博客,但是现在找不到了。查个东西搜半天,下面整理一下php处理redis的例子,个人觉得常用一些例子。下面的例子都是基于php-redis这个扩展的。 1,connect 描述:实例连接到一个Redis. 参数:host: string,port: int 阅读全文

posted @ 2016-06-22 13:56 andydaopeng 阅读(1761) 评论(0) 推荐(0) 编辑

php namespace use 命名空间
摘要:也可以参考PHP官网说明:http://php.net/manual/en/language.namespaces.importing.phpnamespace(以下简称ns)。在定义了一个ns之后,下面所申明的class、interface、const(不包含variable)都是在 申明的ns这... 阅读全文

posted @ 2015-12-24 14:35 andydaopeng 阅读(252) 评论(0) 推荐(0) 编辑

zend studio快捷模板 开发工具之zend studio一些配置
摘要:以下是以Zend Studio 10.0.0版本为基础的: 模板的配置(template): 【菜单】->【Window】->【preferences】->【PHP】->【Editor】->【Templates】->新建模板就可以了, 或者直接在Preferences上面的搜索框中输入templat 阅读全文

posted @ 2014-03-22 18:51 andydaopeng 阅读(548) 评论(0) 推荐(0) 编辑

php开发环境配置 web UI模板
摘要:web ui 能快速的整合进来?dwz? easyui? bootstrap在Apache 中配置:在http.conf中加入php的设置#php5_startphpIniDir "d:/Program Files/php"LoadModule php5_module "d:/Program Fil... 阅读全文

posted @ 2014-02-19 13:34 andydaopeng 阅读(422) 评论(0) 推荐(0) 编辑

PHP为fopen,file_get_contents等函数请求web地址时增加Http头的方法
摘要:我们在使用fsockopen时可以方便的自定义自己请求的http头内容来访问某些对客户端请求头有特殊限制的网站,但是使用fopen,file_get_contents等函数请求web地址时怎么来灵活定义请求的http头呢?解决方案:stream_context_create() 函数fopen实现array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: foo=bar\r\n" ));$context = s 阅读全文

posted @ 2014-01-19 16:15 andydaopeng 阅读(302) 评论(0) 推荐(0) 编辑

php一些技术要点连接地址
摘要:http基本认证:http://www.php.net/manual/zh/features.http-auth.php 阅读全文

posted @ 2014-01-09 14:14 andydaopeng 阅读(89) 评论(0) 推荐(0) 编辑

PHP之open_ssl
摘要:http://www.wapm.cn/phpdoc/zh/openssl.installation.htmlhttp://liuxufei.com/weblog/jishu/376.htmldemo:http://tiandiou.blog.163.com/blog/static/2355668220106108342139/http://www.alixixi.com/program/a/2008050731975.shtml 阅读全文

posted @ 2013-12-27 19:42 andydaopeng 阅读(138) 评论(0) 推荐(0) 编辑

加密解密知识 php非对称加密
摘要:function test1(){ $config = array( "digest_alg" => "sha1", "private_key_bits" => 1024, "private_key_type" => OPENSSL_KEYTYPE_RSA, "encrypt_key" => false ); $res = openssl_pkey_new($config); openssl_pkey_export($res, $priKey); //获取私钥$priKe 阅读全文

posted @ 2013-12-27 17:22 andydaopeng 阅读(949) 评论(0) 推荐(0) 编辑

php实用函数整理
摘要:1. 排序:array_multisort 可以对多位数组的多个字段进行排序例子1如下://自定义数组排序--按转发数从高到低排序 function sortSelfRc($oneLayer){ $myselfSort = array(); //自定义排序数组 $i=0; foreach($oneLayer as $k=>$layer){ $oneLayer[$i] = $layer; unset($oneLayer[$k]); $myselfSort[] = $layer['reposts_count']... 阅读全文

posted @ 2013-11-08 10:20 andydaopeng 阅读(164) 评论(0) 推荐(0) 编辑

php开发环境以及插件的配置安装
摘要:目前网上提供的常用的PHP集成环境主要有AppServ、phpStudy、WAMP和XAMPP等软件 阅读全文

posted @ 2013-11-07 13:14 andydaopeng 阅读(177) 评论(0) 推荐(0) 编辑

php关于日期时间 php日期 php时间
摘要:strtotime 的牛逼用法:$a='-4 days '.date('Y-m-d');$day = date('Y-m-d', strtotime($a));var_dump($day); /** * @name 网页监测日数据处理 * @param string $star... 阅读全文

posted @ 2013-08-23 16:38 andydaopeng 阅读(420) 评论(0) 推荐(0) 编辑

php代理请求
摘要:$url = 'http://192.168.5.241:8893/index.php?a=SendMessage&m=taskSend';$ci = curl_init ();/* Curl settings */curl_setopt ( $ci, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );curl_setopt ( $ci, CURLOPT_CONNECTTIMEOUT, 10 );curl_setopt ( $ci, CURLOPT_TIMEOUT, 10 );curl_setopt ( $ci, CURLOPT 阅读全文

posted @ 2013-08-02 15:51 andydaopeng 阅读(663) 评论(0) 推荐(0) 编辑

php常用系统函数
摘要:首先纯html页要用meta标签声明编码 //有php输出的页要使用header函数声明编码 header("Content-Type:text/html; charset=utf-8");//打开错误信息error_reporting(E_ALL);ini_set('display_errors', true);//设置程序最大可运行时间set_time_limit(180);//获取内存使用情况echo "".memory_get_usage();register_shutdown_function是指在执行完所有PHP语句后再调用函 阅读全文

posted @ 2013-08-01 15:57 andydaopeng 阅读(141) 评论(0) 推荐(0) 编辑

PHP端验证代码、后端验证
摘要:/** * 验证url是否存在 * @param string $url url路径 * @return boolean true:存在,false:不存在 */ public function validUrl($url){ // 1. 初始化 $ch = curl_init(); // 2. 设置选项,包括URL curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); // 3. 执行并获... 阅读全文

posted @ 2013-07-31 15:35 andydaopeng 阅读(226) 评论(0) 推荐(0) 编辑

php测试代码工具类
摘要:请输入要测试内容 : "),"",$param); $rtn = eval($param); echo ""; if($rtn === false){ var_dump($param); } } 阅读全文

posted @ 2013-07-25 11:57 andydaopeng 阅读(318) 评论(0) 推荐(0) 编辑

php正则测试demo、动态函数
摘要:正则表达式 :"> 测试字符串 :"> ";if(preg_match_all($pattern, $subject, $matches)){var_dump($matches);}else{echo "preg_match_all({$pattern}, {$subject}) 未匹配到"."\n";}}各种正则模式: 'email' => "/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/", 'telA 阅读全文

posted @ 2013-07-24 11:48 andydaopeng 阅读(1022) 评论(0) 推荐(0) 编辑

php动态调用方法_sux
摘要:<?phpif(!empty($_GET['funcName'])){$funcName = trim($_GET['funcName']);$funcName();}function activeMethod($methodName){$methodName();}function test(){echo 'test';} 阅读全文

posted @ 2013-07-24 10:49 andydaopeng 阅读(277) 评论(0) 推荐(0) 编辑

php输出错误信息
摘要:error_reporting(E_ALL); ini_set('display_errors','on');header("Content-Type:text/html;charset=utf-8"); 阅读全文

posted @ 2013-07-24 10:44 andydaopeng 阅读(537) 评论(0) 推荐(0) 编辑

php验证输入字符串中含有非法字符
摘要:$pattern = "/(&amp;|&quot;|&lt;|&gt;|')+/"; preg_match($pattern, $media_name, $matches); var_dump($matches,$media_name); exit(); if($matches){ printJs 阅读全文

posted @ 2013-07-23 17:27 andydaopeng 阅读(2349) 评论(0) 推荐(0) 编辑

php单引号、双引号与数据库
摘要:/** * 初始化http参数数据 */public static function init () {if (!get_magic_quotes_gpc()) {$_POST = faddslashes($_POST); $_GET = faddslashes($_GET); $_COOKIE = faddslashes($_COOKIE); $_FILES = faddslashes($_FILES); $_REQUEST = faddslashes($_REQUEST);}self::$DATA = array_merge($_GET, $_POST);self::$METHOD = @ 阅读全文

posted @ 2013-07-23 16:39 andydaopeng 阅读(364) 评论(0) 推荐(0) 编辑

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示