摘要: (转载)http://developer.51cto.com/art/200912/166080.htm我们在使用PHP语言进行实际编码中时,通常会遇到许多错误的出现,比如在截取字符串时会出现乱码等。我们今天就要为大家介绍如何正确的运用PHP mb_substr函数,减少错误的发生。1.确保你的Windows/system32下有php_mbstring.dll这个文件,没有就从你Php安装目录extensions里拷入Windows/system32里面。2.在windows目录下找到php.ini打开编辑,搜索mbstring.dll,找到;extension=php_mbstring.d 阅读全文
posted @ 2013-06-17 20:33 robotke1 阅读(218) 评论(0) 推荐(0)
摘要: (转载)http://blog.csdn.net/alongken2005/article/details/7098506PHP substr()函数可以 分割文字,但要分割的文字如果包括中文字符往往会遇到问题,这时可以用mb_substr()/mb_strcut这个函数,mb_substr() /mb_strcut的用法与substr()相似,只是在mb_substr()/mb_strcut最后要加入多一个参数,以设定字符串的编码,但是 一般的服务器都没打开php_mbstring.dll,需要在php.ini在把php_mbstring.dll打开。mbstring 函数的说明:php的m 阅读全文
posted @ 2013-06-17 20:30 robotke1 阅读(249) 评论(0) 推荐(0)
摘要: (转载)http://developer.51cto.com/art/201105/263103.htm在PHP中,strlen与mb_strlen是求字符串长度的函数,但是对于一些初学者来说,如果不看手册,也许不太清楚其中的区别。下面通过例子,讲解这两者之间的区别。先看例子:<?php //测试时文件的编码方式要是UTF8 $str='中文a字1符'; echo strlen($str).'<br>';//14 echo mb_strlen($str,'utf8').'<br>';//6 echo 阅读全文
posted @ 2013-06-17 20:16 robotke1 阅读(205) 评论(0) 推荐(0)
摘要: (转载)http://php.net/manual/zh/function.apc-fetch.phpapc_fetch(PECL apc >= 3.0.0)apc_fetch—从缓存中取出存储的变量Report a bug说明mixedapc_fetch(mixed$key[,bool&$success] )从缓存中取出存储的变量Report a bug参数keykey是使用apc_store()存储的键名。 如果传递的是一个数组,则数组中的每个元素的值都被返回successSet toTRUEin success andFALSEin failure.Report a bug 阅读全文
posted @ 2013-06-17 16:49 robotke1 阅读(340) 评论(0) 推荐(0)
摘要: (转载)http://www.neatstudio.com/archives/?article-2061.html时隔一年多,APC终于又更新了,这次更新最大的就是支持PHP5.4:- Add PHP 5.4 support (Dmitry, Anatoliy, Pierre)- Fixed bug #22679: Fix apc_bin_dump for constants. Use IS_CONSTANT_TYPE_MASK to handle all the constants, including the unqalified ones (instead of ~IS_CONSTANT 阅读全文
posted @ 2013-06-17 16:45 robotke1 阅读(299) 评论(0) 推荐(0)
摘要: (转载)http://justcoding.iteye.com/blog/601117/代码://定义编码header( 'Content-Type:text/html;charset=utf-8 ');//Atomheader('Content-type: application/atom+xml');//CSSheader('Content-type: text/css');//Javascriptheader('Content-type: text/javascript');//JPEG Imageheader('C 阅读全文
posted @ 2013-06-17 15:32 robotke1 阅读(276) 评论(0) 推荐(0)
摘要: test1.php<?PHP $g_user = "Jack"; echo $g_user;?>test3.php<?PHP header('Location: http://localhost/testDtwfile/test1.php'); echo "-------------------------".'<br>';?>首先我们在浏览器中输入:刷新:从上面可以看到页面跳转到test1.php这个网页中了。 阅读全文
posted @ 2013-06-17 15:23 robotke1 阅读(231) 评论(0) 推荐(0)
摘要: (转载)http://www.cnitblog.com/neatstudio/archive/2006/07/21/13990.htmlphp之call_user_func_array的简易用法今天在群里面,有个叫lewis的在问call_user_func_array的用法,因为之前一直没有用过,也不能说什么,于是看一下手册,发现是这么写的:call_user_func_array(PHP 4 >= 4.0.4, PHP 5)call_user_func_array-- Call a user function given with an array of parameters Des 阅读全文
posted @ 2013-06-17 14:10 robotke1 阅读(340) 评论(0) 推荐(0)
摘要: (转载)http://www.w3school.com.cn/php/func_array_merge.aspPHP Array 函数定义和用法array_merge() 函数把两个或多个数组合并为一个数组。如果键名有重复,该键的键值为最后一个键名对应的值(后面的覆盖前面的)。如果数组是数字索引的,则键名会以连续方式重新索引。注释:如果仅仅向 array_merge() 函数输入了一个数组,且键名是整数,则该函数将返回带有整数键名的新数组,其键名以 0 开始进行重新索引。(参见例子 2)语法array_merge(array1,array2,array3...)参数描述array1必需。输入的 阅读全文
posted @ 2013-06-17 11:48 robotke1 阅读(234) 评论(0) 推荐(0)
摘要: (转载)http://www.w3school.com.cn/php/func_array_slice.aspPHP Array 函数定义和用法array_slice() 函数在数组中根据条件取出一段值,并返回。注释:如果数组有字符串键,所返回的数组将保留键名。(参见例子 4)语法array_slice(array,offset,length,preserve)参数描述array必需。规定输入的数组。offset必需。数值。规定取出元素的开始位置。如果是正数,则从前往后开始取,如果是负值,从后向前取 offset 绝对值。length可选。数值。规定被返回数组的长度。如果 length 为正, 阅读全文
posted @ 2013-06-17 11:01 robotke1 阅读(264) 评论(0) 推荐(0)
摘要: (转载)http://hi.baidu.com/daihui98/item/a67dfb8213055dd75f0ec165php反射类 ReflectionClass什么是php反射类,可以理解为一个类的映射。举个例子:class fuc{//定义一个类staticfunctionec(){echo'我是一个类';}}$class=new ReflectionClass('fuc');//建立fuc这个类的反射类echo$class;//输出这反射类Class[classA]{@@ F:\phpweb\myPHP\test.php23-30-Constants 阅读全文
posted @ 2013-06-17 10:25 robotke1 阅读(273) 评论(0) 推荐(0)
摘要: (转载)http://s.yanghao.org/program/viewdetail.php?i=184313php的类中可以不定义成员变量,直接在构造方法中使用并赋值吗?class block { function block() { $this->iconWidth = "23"; $this->iconHeight = "23"; $this->bgColor = "#5B7F93"; $this->fgColor = "#C4D3DB"; $this->oddColor = 阅读全文
posted @ 2013-06-17 10:20 robotke1 阅读(893) 评论(0) 推荐(0)