上一页 1 ··· 65 66 67 68 69 70 71 72 73 ··· 96 下一页
摘要: [代码] [PHP]代码view source01 <?php02 define('ROOT','D:/Program Files/www/test/');03 class Files_Tool{04 protected static $allowExt=array('.jpg','.jpeg','.png','.gif','.bmp','.svg','.chm','.pdf','.zip','.rar&# 阅读全文
posted @ 2013-02-04 11:52 幻星宇 阅读(155) 评论(0) 推荐(0) 编辑
摘要: [代码] [PHP]代码001<?php002/************003*汉字转换拼音Class005*************/006class pin{007function Pinyin($_String, $_Code='gb2312'){008010"|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|".011"cuan|cui|cun|cuo|da|dai|dan|d 阅读全文
posted @ 2013-02-04 11:46 幻星宇 阅读(1044) 评论(0) 推荐(0) 编辑
摘要: [代码] [PHP]代码1function extract_emails_from($string) {2//加入对#的判断,这个你懂的^_^ http://blog.ddian.cn3preg_match_all("/[\._a-zA-Z0-9-]+(@|#)[\._a-zA-Z0-9-]+/i", $string, $matches);4return $matches[0];5} 阅读全文
posted @ 2013-02-04 11:45 幻星宇 阅读(232) 评论(0) 推荐(0) 编辑
摘要: [代码] [PHP]代码01$language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2);02//获取访客语言,是HTTP头信息的ACCEPT_LANGUAGE的前两个字符03// http://blog.ddian.cn04if($language != 'zh'){05//zh是中文,包括zh-CN简体中文和zh-TW正体中文06header("Location: /yourpage.html");07//这句代码是将用户转向到根目录的yourpage.html这里08exit;09// 阅读全文
posted @ 2013-02-04 11:38 幻星宇 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 网站要做个每天定时更新的功能,可老板要求不能在服务器上长期打开一个页面,这样也不是我所期望的。这就想到了windows的task功能。来看看下面的操作:1、首先将“F:\PHP\php.exe F:\www\htdocs\a.php”写入到”new_zw.tast“(bat文件名可以自己取)文件中。2、”控制面板“=》”任务计划“=》”添加任务计划“,选择添加自己的新建的”new_zw.tast“文件,然后根据自己需要进行配置。(注意:那个密码要填写你对应的用户名的密码) 阅读全文
posted @ 2013-02-04 11:30 幻星宇 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 一.首先是PHP网页的编码1.php文件本身的编码与网页的编码应匹配a.如果欲使用gb2312编码,那么php要输出头:header(“Content-Type: text/html; charset=gb2312"),静态页面添加<meta http-equiv="Content-Type" content="text/html; charset=gb2312">,所有文件的编码格式为ANSI,可用记事本打开,另存为选择编码为ANSI,覆盖源文件。b.如果欲使用utf-8编码,那么php要输出头:header(“Content-T 阅读全文
posted @ 2013-02-04 11:27 幻星宇 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 本文将介绍Php 生成静态html文件的三种方法 。1,下面使用模版的一个方法!<?php $fp = fopen ("templets.html","a"); if ($fp){ $fup = fread ($fp,filesize("templets.html")); $fp2 = fopen ("html.shtml","w"); if ($fwrite ($fp2,$fup)){ $fclose ($fp); $fcolse ($fp2); die ("写入模板成功&qu 阅读全文
posted @ 2013-02-04 11:00 幻星宇 阅读(1419) 评论(0) 推荐(0) 编辑
摘要: API获取天气预报,以及使用飞信API,给好友发送短信 加上计划任务,就可以持续每天自动发送天气预报给自己和亲人啦。。。 <?php ########## # jiam 2012/12/5 # 1113160783@qq.com #自动发送飞信 #中间涉及到飞信接口 #天气预报API #以及城市代码 ########## #101180101是郑州城市代码 #101180301是新乡城市代码 $url='http://m.weather.com.cn/data/101180101.html'; $xinxiang='http://m.weather.com.cn/ 阅读全文
posted @ 2013-02-03 14:30 幻星宇 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 这个抽奖小程序,在实际的测试环境中也可以用到,比方说测试数据的查询在in条件下,要查询随机的5个id,然后在用ab去压测[代码][PHP]代码view sourceprint?01<?php02/**03* “抽奖”函数04*05* @param integer $first 起始编号06* @param integer $last 结束编号07* @param integer $total 获奖人数08*09* @return string10*11*/12functionisWinner($first,$last,$total)13{14$winner=array();15for($ 阅读全文
posted @ 2013-02-03 14:19 幻星宇 阅读(271) 评论(0) 推荐(1) 编辑
摘要: [代码][PHP]代码view sourceprint?01<?php02/**03* @author phpman.cn04* @date 2012/12/0405* @todo 简单洗牌算法06*/0708$card_num=54;//牌数09print_r(wash_card($card_num));1011functionwash_card($card_num)12{13$cards=$tmp=array();14for($i=0;$i<$card_num;$i++){15$tmp[$i]=$i;16}1718for($i=0;$i<$card_num;$i++){1 阅读全文
posted @ 2013-02-03 14:15 幻星宇 阅读(365) 评论(0) 推荐(0) 编辑
上一页 1 ··· 65 66 67 68 69 70 71 72 73 ··· 96 下一页