【php字符串分割函数explode的实例代码】教程文章相关的互联网学习教程文章

PHP函数:判断远程文件是否存在实例代码_PHP教程

本文介绍PHP函数 - 判断远程文件是否存在实例代码/* 函数:remote_file_exists 功能:判断远程文件是否存在 参数: $url_file - 远程文件URL 返回:存在返回true,不存在或者其他原因返回false*/function remote_file_exists($url_file){ //检测输入 $url_file = trim($url_file); if (empty($url_file)) { return false; } $url_arr = parse_url($url_file); if (!is_array($url_arr) || empty($url_arr)){ re...

php取得系统启动时间长短实例代码_PHP教程

php取得系统启动时间长短实例代码 //系统启动时间计算. $UPTIME = 32936982.68; $DAY = floor(($UPTIME / 86400)*1.0) ; $cal_day = $DAY * 86400 ; $cal_hour = $UPTIME - $cal_day ; $hour = floor(($cal_hour / 3600)*1.0) ; if ($hour $hour = "0".$hour ; } $cal_tmp = $hour * 3600 ; $cal_min = $cal_hour - $cal_tmp ; $min = ...

php生成zip压缩文件实例代码讲解_PHP教程

php压缩文件zip的例子 1.请先下载我准备好的zip.php工具类,下载后解压,将里面的文件放入对应的目录中,我是放在虚拟目录下的include文件夹中。2.在你的php文件中加入下面代码即可用法:require_once "./include/zip.php";$zip = new PHPZip();//$zip -> createZip("要压缩的文件夹目录地址", "压缩后的文件名.zip");   //只生成不自动下载$zip -> downloadZip("要压缩的文件夹目录地址", "压缩后的文件名.zip"); //自动下载实...

PHP读取mysql数据库数据并实现分页实例代码_PHP教程【图】

PHP读取mysql数据库数据并实现分页实例代码如下: //连接数据库 $db=mysql_connect("localhost","root","root"); mysql_select_db("gaoge",$db); //设定每一页显示的记录数 $pagesize=3; //取得记录总数,计算总页数用 $res=mysql_query("select count(*) from image " ,$db); $myrow = mysql_fetch_array($res); //$myrow[o]为数据库里总记录数目之和 $numrows=$myrow[0]; //echo "total nu...

phpheader函数使用实例代码_PHP教程

/*** Function: PHP header() examples (PHP)** Desc: Some examples on how to use the header() function of PHPYou find a detailed tutorial at expertsrt.com (English) or at ffm.junetz.de (German).These is also a good help about caching at web-caching.com.** Example: see below. Tip: You can use these sites to check your headers: web-sniffer.net, delorie.com or www.forret.com.** Author: Jonas John*/// f...

PHP获取网页文件大小实例代码_PHP教程

$host="www.ite5e.com"; $fp = fsockopen("$host", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno) "; } else { $out = "GET / HTTP/1.1 "; $out .= "Host: $host "; $out .= "Connection: Close"; } fwrite($fp, $out); $i=0; while($i{ $i ; $con.=fread($fp,500); } // echo $con; //定义取出的字节数 preg_match("/Content-Length:.?(d )/", $con, $matches); $s...

PHP在数组中加法运算操作实例代码_PHP教程

PHP 在数组中加法运算操作实例代码 $a = array("a" => "apple", "b" => "banana"); $b = array("a" => "pear", "b" => "strawberry", "c" => "cherry"); $c = $a $b; // Union of $a and $b echo "Union of $a and $b: "; var_dump($c); $c = $b $a; // Union of $b and $a echo "Union of $b and $a: "; var_dump($c);?> array(3) { ["a"]=> ...

PHP输出excel文件实例代码_PHP教程

PHP输出excel文件实例代码header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:attachment;filename=users.xls" ); echo "公司名称"." "; echo "用户名"." "; echo "密码"." "; echo "二级域名"." "; echo " "; foreach($result[result] as $val){ echo "$val->ComName"." "; echo "$val->UserName"." "; echo "$val->UserTruePw"."...

php数据统计图类实例代码详解_PHP教程【图】

<?php/**** 时间 2010-8-9* www.ite5e.com* 注意:如有什么问题可以回帖。* 程序最底下有调用测试代码。***/define("DEFAULT_FONT_PATH", "c:/windows/fonts/simhei.ttf");class barbarism{ private $_x; private $_y; private $_h; public $_l = 50; private $_w = null; private $_srcPoints = array(); private $_points = array(); public function __construct($x, $y, $h, $l = 50, $w = null) ...

php数组转换成对象实例代码_PHP教程

php 数组转换成对象实例代码,本程序经过编程之家测试真常运行贴出来的。$array = array(1 => php, 2 => java, 3 => c ); $arrayobject = new ArrayObject($array); var_dump($arrayobject); ?>运行结果:object(ArrayObject)#1 (1) {["storage":"ArrayObject":private]=>array(3) {[1]=>string(3) "php"[2]=>string(4) "java"[3]=>string(3) "c "} } http://www.bkjia.com/PHPjc/486154.htmlwww.bkj...

php生成验证码实例代码_PHP教程

下面是生成验证码代码,结果编程之家本站测试过,没错误贴上来的。如果有什么不懂的地方可以回复,编程之家会为你解释不了解之处。希望能对你有所收获。session_start();$nums = rand(1000,9999);$_SESSION[nums]=$nums;$imgs = ImageCreatetruecolor(100, 35);$one = Imagecolorallocate($imgs, 0, 0, 0);$two = Imagecolorallocate($imgs, rand(0, 255), rand(0, 255), rand(0, 255));$thr = Imagecolorallocate($imgs, ra...

PHP实现静态HTML页面统计浏览次数实例代码_PHP教程

PHP 实现静态HTML页面统计浏览次数实例代码 news.html 记录访问次数

讲解php创建文件实例代码_PHP教程

讲解php创建文件实例代码:$data =date("Ymd");$dir ="/hom/kyle/file/$data";$filename ="/home/kyle/file/$data/testfile";$filecontent ="这是要写入的内容 测试空格 空格 ";//判断文件夹是否存在,否则创建if(!is_dir($dir)){ mkdir($dir,0777);}//判断文件是否存在,否则创建if(!file_exists($filename)){ $handle=fopen($filename,w); if(!$handle){ echo create file fail; exit; }else{ chmod...

PHP生成表格实例代码_PHP教程

下面代码PHP生成表格实例,经过本站编程之家测试正常运行后贴出来的。$link=mysql_connect("localhost","root","123456");$db=mysql_select_db("bustest",$link);$sql1="select name from info group by name order by id asc";print("");$res1=mysql_query($sql1);while($row1=mysql_fetch_array($res1)){ $name=$row1["name"]; $sql2="select id from info where name =$name order by id asc"; $res2=mysql_query($sql...

PHP文件记录访问者IP实例代码_PHP教程

php 文件记录访问者IP实例代码 ,代码很少,在PHP环境里可以运行,希望可以帮助有需要的人。$fp = fopen("log.txt","a ");fwrite($fp,date("Y-m-d H:i:s"));fwrite($fp," ");fwrite($fp,$_SERVER[REMOTE_ADDR]);fwrite($fp," ");fwrite($fp,$_SERVER[HTTP_X_REWRITE_URL]);fwrite($fp," ");fwrite($fp,$_SERVER[HTTP_USER_AGENT]);fwrite($fp," ");fwrite($fp,$_SERVER["HTTP_REFERER"]);fwrite($fp," ");fclose($fp); ?>http://www...