php 获取访问页面的http状态码 代码段

php function GetHttpStatusCode($url){ $curl = curl_init(); curl_setopt($curl,CURLOPT_URL,$url);//获取内容url

cp5m 2015-04-23   1705   0
PHP  

如何用php抓取网页中邮箱地址代码 代码段

php /** desc:采集网页中的邮箱的代码 */ $url='http://www.xxx.net'; //要采集的网址 $content=file_get_contents($url); //echo

jopen 2015-07-08   750   0
PHP  

PHP把秒转换成天数,小时数和分钟 代码段

second';if($secs<>1){$r.='s';} return $r; } 用法: php $seconds = "56789"; $output = secsToStr($seconds);

gw23e 2015-08-09   2500   0
PHP  

PHP 获取访问者IP地址 代码段

获取访问者IP地址 [PHP]代码 static public function getip() { if (getenv("HTTP_CLIENT_IP") && strcasecmp(gete

ouhp9343 2016-01-23   2068   1

将时间显示为“刚刚”“n分钟/小时前”等的PHP代码 代码段

php date_default_timezone_set('PRC'); $date = "1351836000"; echo tranTime($date); function transfer_time($time)

efy6 2015-01-10   1064   0
PHP  

php把一个颜色变深的函数 代码段

这个php函数可以把指定的颜色变得更深一些 function ColorDarken($color, $dif=20){ $color = str_replace('#', '', $color); if

cf46d 2015-01-31   1563   0
PHP  

php返回当前日期或者指定日期是星期几 代码段

PHP星期几获取代码: date("l"); //data就可以获取英文的星期比如Sunday date("w"); //这个可以获取数字星期比如123,注意0是星期日 获取中文星期几: $weekarray=array("日"

phpw34 2015-04-21   898   0
PHP  

将颜色转换为其反色的PHP代码 代码段

这段php代码可以把一个颜色变成与之相反的颜色编码,如:白色变成黑色,蓝色变成黄色 function color_inverse($color){ $color = str_replace('#', ''

cf46d 2015-01-31   1265   0
PHP  

遍历某文件夹下的所有文件和文件夹php代码 代码段

php遍历某文件夹下的所有文件和文件夹 function list_dir($dirpath){ if($dirpath[strlen($dirpath)-1]!="\\"){$dirpath.="\\";}

n7w77 2015-03-19   829   0
PHP  

php生成一定数量的不重复随机数 代码段

php /* * array unique_rand( int $min, int $max, int $num ) * 生成一定数量的不重复随机数 * $min 和 $max: 指定随机数的范围

phpw34 2015-04-21   1362   0
PHP  

php获得文件大小和文件创建时间 代码段

php中可以显示文件的各种属性,这些属性包括文件的最后访问时间、最后修改时间、文件大小等。 Returning information about a file

cxx3 2015-04-26   843   0
PHP  

防止SQL注入的PHP 函数 代码段

return the clean text return $output; } 用法: php $text = ""; $text = clean($text);

gw23e 2015-08-09   1027   0
PHP  

利用PHP内置dir类实现目录遍历删除 代码段

如题 利用PHP内置dir类实现目录遍历删除 function clearDir( $dir ) { if (file_exists( $dir )) { if(!is_dir( $dir ))

suxiang. 2016-01-23   673   0
PHP  

PHP汉字转拼音函数 代码段

http://meego123.net/ [PHP]代码 php function Pinyin($_String, $_Code='UTF8'){ //GBK页面可改为gb2312,其他随意填写为UTF8

ouhp9343 2016-01-23   725   0
PHP  

PHP算式验证码和汉字验证码的实现方法 代码段

PHP网站开发中,验证码可以有效地保护我们的表单不被恶意提交,但是如果不使用算式验证码或者汉字验证码,仅仅使用简单的字母或者数字验证码,这样的验证码方案真的安全吗? 大家知道简单数字或者字母验证

jopen 2015-03-08   4237   0
PHP  

PHP压缩zip文件 zip压缩文件创建类 代码段

php /* * Zip file creation class. * Makes zip files. * * Based on : * * http://www.zend.com/codex.php

efy6 2015-01-10   1547   0
PHP  

php获取图片详细信息(宽 高 格式 大小) 代码段

php function getImageInfo($img) //$img为图像文件绝对路径 { $img_info = getimagesize($img); switch ($img_info[2])

dy223 2015-03-26   1789   0
PHP  

php 四舍五入的三种方法 代码段

php 四舍五入的三种方法,分别通过number_format函数、round函数和sprintf格式化输出的方法实现四舍五入 1.number_format 方法实现四舍五入 $number = 1234

phpw34 2015-04-21   1413   0
PHP  

php计算两个坐标(经度,纬度)之间的距离 代码段

php计算两个坐标(经度,纬度)之间的距离,返回结果为米或者千米 function distance($lat1, $lng1, $lat2, $lng2, $miles = true) { $pi80

jphp 2015-05-11   1271   0
PHP  

php上传图片时生成缩略图 代码段

php function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth, $quality){

ded3b 2015-01-23   1041   0
PHP  
1 2 3 4 5 6 7 8 9 10