【PHP类商品秒杀计时实现代码_php技巧】教程文章相关的互联网学习教程文章

PHPwhois客户端查询的实现代码

/*** whois信息查询* by bbs.it-home.org*/function ae_whois($query, $server){ define('AE_WHOIS_TIMEOUT', 15); // connection timeout global $ae_whois_errno, $ae_whois_errstr; // connecting $f = fsockopen($server, 43, $ae_whois_errno, $ae_whois_errstr, AE_WHOIS_TIMEOUT); if (!$f) return false; // connection failed // sending query fwrite($f, $query."\r\n"); // rece...

php队列(Queue)数据结构的实现代码

本文介绍下,在php中实现队列queue数据结构的一例代码,是学习队列操作的不错的例子,有需要的朋友参考下吧。什么是队列? 队列(Queue),是一种特殊的先进先出线性表,其只能在前端进行删除操作(一般称为出队),在后端进行插入操作(一般称为入队)。 进行删除操作的端称为队头,进行插入操作的端称为队尾。队列,是按照先进先出或后进后出的原则组织数据。当队列中没有元素时,称为空队列。 下面分享下,php实现的数据结构与算...

php获取文本框中值的实现代码

文本框的用法: 其中input类型包括text、password等类型。 填入表单提交后: if(!isset($_POST['submit'])) return ; if($_POST['submit']=='submit'){ $username = $_POST['username']; $password = $_POST['password']; } echo 管理员:$username 密码:$password EOT; ?> 使用 isset()函数判断$_POST[submit]是否被设置。

php记录蜘蛛爬行历史的实现代码

本文介绍下,用php实现的记录蜘蛛爬行历史的一段代码,用于分析蜘蛛对网站的爬行记录还是不错的,对研究seo也有好处,有需要的朋友参考下吧。PHP记录蜘蛛爬行历史的代码,如下:

php调用yahoosinaapi天气预报的实现代码

header ( 'Content-Type: text/html; charset = utf-8' );class weather { static $url = 'http://xml.weather.yahoo.com/forecastrss?u=c&w='; static $city = 'Beijing'; //默认城市北京 这里要注意的是 city 要填拼音 我试过用中文有好几个地区都调用不到 static $weatherXML = ''; static $woeid_file = "woeid"; static $file_path = "data/"; /** * 获得远程xml并缓存到本地 ...

PHP获取网页源代码、网页标题的实现代码

$lines = file('http://bbs.it-home.org/');foreach ($lines as $line_num => $line) {echo "Line {$line_num} : " . htmlspecialchars($line) . "\n";}?>2,获取网页的标题:$url = 'http://bbs.it-home.org';$lines_array = file($url);echo $lines_array;echo "";$lines_string = implode('', $lines_array);eregi("(.*)", $lines_string, $head);echo "head:".$head;echo "";print_r($head);echo "";echo "title:".$head[1];?>

php即时网站截图的实现代码【图】

2,php代码部分$x = $_REQUEST['x'];$y = $_REQUEST['y'];$format = $_REQUEST['format'];$site = $_REQUEST['site'];$surl = 'http://jbxue.com/screenshot_it.php?site='.$site.'&x='.$x.'&y='.$y.'&format='.$format;if($_REQUEST['format'] == 'PNG') {$ifm = 'png';} else {$ifm = 'jpg';}$imt = 'image/'.$ifm;$ifn = 'screenshot.'.$ifm;if(isset($_REQUEST['preview'])) {$iurl = 'http://域名/子目录/screenshot_it.php?s...

php导出CSV文件的实现代码

// 注意包含正确的类路径require_once(dirname(__FILE__) . '/export.php');$exceler= newJason_Excel_Export(); // 生成excel格式 这里根据后缀名不同而生成不同的格式。$exceler->setFileName('jason_excel.xls'); // 生成csv格式// $exceler->setFileName('jason_excel.csv'); // 设置excel标题行$excel_title= array('第一列', '第二列', '第三列');$exceler->setTitle($excel_title); // 设置excel内容$excel_data= array...

php导出与读取csv文件的实现代码

$users = file("./demoCSV.csv"); foreach ($users as $user) { list($name, $email, $phone) = explode(",", $user); echo "$name ($email) Tel. $phone"; } //edit by bbs.it-home.org?>A,a@example.com,11111B,b@example.com,22222例2,fgetcsv读取一个csv文件 $fh = fopen("./demoCSV.csv", "r"); while (list($name, $email, $phone) = fgetcsv($fh, 1024, ",")) { echo "$name ($email) Tel. $phone"...

php列出目录中所有子目录的实现代码

/*** 取出指定目录的所有子目录* edit: bbs.it-home.org* 2013/10/9*/function listdir($dir){ if ($handle = opendir($dir)){ $output = array(); while (false !== ($item = readdir($handle))){ if (is_dir($dir.'/'.$item) and $item != "." and $item != ".."){ $output[] = $dir.'/'.$item; $output = array_merge($output, ListDescendantDirectories($dir.'/'....

php简单日历的实现代码(可绑定事件)

/*** php简单日历* edit: bbs.it-home.org*/if(empty($year))$year=date("Y"); //初始化年份 if(empty($month))$month=date("n"); //初始化月份 $wd_ar=array("日","一","二","三","四","五","六"); //星期数组 $wd=date("w",mktime(0,0,0,$month,1,$year)); //当月第一天是星期几//年链接 $y_lnk1=$year$y_lnk2=$year>=2037?$year=2037:$year+1;//月链接 $m_lnk1=$month$m_lnk2=$month>=12?$month=12:$month+1;echo EOT;for(...

PHP获取MAC地址的实现代码

/** * 获取机器网卡的物理(MAC)地址* 目前支持WIN/LINUX系统 * 编辑: bbs.it-home.org**/ class MacAddInfo { var $return_array = array (); // 返回带有MAC地址的字串数组 var $mac_addr; function MacAddInfo($os_type) { switch (strtolower ( $os_type )) { case "linux" : $this->forLinux (); break; case "solar...

php时间日期工具类的实现代码

/*** 功能:php时间与日期工具类* 编辑:bbs.it-home.org*/DateTimeUtils::addDate('2013-12-01',1,'y'); DateTimeUtils::getWeekDay('2013/10/01','/'); DateTimeUtils::isLeapYear('2013'); DateTimeUtils::timeFromNow(strtotime("2013-10-26 14:15:13")); class DateTimeUtils { /** * Checks for leap year, returns true if it is. No 2-digit year check. Also * handles julian calendar correctly. ...

PHP阴历转农历的实现代码

<?php/****PHP阴历转农历* by bbs.it-home.org*/class Lunar {var $MIN_YEAR = 1891;var $MAX_YEAR = 2100;var $lunarInfo = array(array(0,2,9,21936),array(6,1,30,9656),array(0,2,17,9584),array(0,2,6,21168),array(5,1,26,43344),array(0,2,13,59728),array(0,2,2,27296),array(3,1,22,44368),array(0,2,10,43856),array(8,1,30,19304),array(0,2,19,19168),array(0,2,8,42352),array(5,1,29,21096),array(0,2,16,53856),arr...

PHP+Ajax实时自动检测是否联网的实现代码

PHP+Ajax实时自动检测是否联网-bbs.it-home.org PHP+Ajax实时自动检测是否联网 当前网络状态: 2,php代码<?php//检测网络连接,是否已联网public function getNetLink(){ header("cache-control:no-cache,must-revalidate"); header("Content-Type:text/html;charset=utf-8"); $file=fopen("http://bbs.it-home.org/", "r"); if (!$file){ $shownetlink = "网络连...