当前位置:首页 > PHP教程 > php函数 > 列表

php判断远程图片是否存在

添加日期:2014-08-16 10:36:09 发布:smiling 
functionimg_exits($url){$ch=curl_init();curl_setopt($ch,curlopt_url,$url);curl_setopt($ch,curlopt_nobody,1); 不下载curl_setopt($ch,curlopt_failonerror,1);curl_setopt($ch,curlopt_retu ...

PHP中GBK和UTF8编码处理(中文,韩文)

添加日期:2014-08-16 09:36:18 发布:smiling 
一、编码范围1 gbk (gb2312 gb18030)x00-xff gbk双字节编码范围x20-x7f asciixa1-xff 中文x80-xff 中文2 utf-8 (unicode)u4e00-u9fa5 (中文)x3130-x318f (韩文)xac00-xd7a3 (韩文)u0800-u ...

php域名whois查询函数

添加日期:2014-08-16 08:54:08 发布:smiling 
functionwhois_hichina($domain){preg_match("|<pre>( +?)< pre>|is",@file_get_contents(& 39;http: whois hichina com cgi-bin whois?domain=& 39; $domain & 39;& 39;),$whois);$whois[0]=str_ ...

ob_start()、ob_end_clean()、ob_get_contents()函数

添加日期:2014-08-15 16:16:08 发布:smiling 
三个函数:"ob_start()、ob_end_clean()、ob_get_contents()"ob_start():是打开缓冲区的,就是要把您需要生成的静态文件的内容缓存在这里;ob_get_contents():是读出缓冲区里的内容,下面有代码为例 ...

php获取文件大小并转换gb,mb,kb代码

添加日期:2014-08-15 16:14:08 发布:smiling 
这是一款利用php程序来获取文件的大小并且把文件根据文件的大小显示gb,mb,kb代码的代码非常智能的代码,代码如下:functionsizecount($filesize){if($filesize>=1073741824){$filesize=round($filesi ...

php substr中文乱码解决办法

添加日期:2014-08-15 15:45:57 发布:smiling 
如果直接使用substr截取中文字符串肯定会出乱码的,因为他会把一个汉字分成一半,为什么会这样,因为机器内部编码的问题,现在我们来看处理办法1、使用mbstring扩展库的mb_substr截取就不会出现乱码了 ...

php 检测字符编码mb_detect_encoding()函数

添加日期:2014-08-06 15:12:29 发布:smiling 
文章提供这款mb_detect_encoding函数是一款可以检测你使用的字符串是什么编码,然后返回字符串编码字符,下面是一个简单应用实例 functionasciitog($brand){$cha=mb_detect_encoding($brand);if($cha ...

生成随机字符串,包含大写、小写字母、数字php代码

添加日期:2014-08-06 15:00:54 发布:smiling 
functionrandstr($length){$hash=& 39;& 39;;$chars=& 39;abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz& 39;;$max=strlen($chars)-1;mt_srand((double)microtime()*1000000);for($i=0;$i<$length;$i++){$hash =$chars[mt_rand(0,$max)];}return$hash;}...

php中数据转换成url的http_build_query函数

添加日期:2014-08-06 14:22:34 发布:smiling 
用法:http_build_query($formdata[,string $numeric_prefix[,string $arg_spearotor]])http_build_query函数是php5加入的,作用就是把数组或对象转换成url的querystring,代码如下:<?php* $data=ar ...

php 中英文字符串截取函数

添加日期:2014-08-05 16:33:07 发布:smiling 
***php获取字符串中英文混合长度*@param$strstring字符串*@param$$charsetstring编码*@return返回长度,1中文=1位,2英文=1位* functionst ...

php 取得客户端IP地址代码

添加日期:2014-08-05 15:36:41 发布:smiling 
<? 开源代码functiongetip(){if(getenv("http_client_ip")&&strcasecmp(getenv("http_client_ip"),"unknown"))$ip=getenv("http_client_ip"); 开源elseif(getenv("http_x_forwarded_for")&&strca ...

php 获取客户浏览器与操作系统类型

添加日期:2014-08-05 15:25:47 发布:smiling 
<?phpfunctionbrowse_infor(){$browser="";$browserver=""; $browsers=array("lynx","mosaic","aol","opera","java","macweb","webexplorer","omniweb");$agent=$globals["http_user_agent"];for( ...

php curl用法

添加日期:2014-08-05 14:11:00 发布:smiling 
在php使用curl时必须先在php ini中开启extension=php_curl dll前面的;去了才行,curl是php中一款内置的浏览器,它可以模仿用户浏览信息进行网站浏览,等下面来看一实例,代码如下:functionpostpage($ur ...