易截截图软件、单文件、免安装、纯绿色、仅160KB

学习php Reflection(一)

看yii框架源码的时候,发现了
ReflectionClass这个方法,才发现原来是php5的新东西,于是稍微研究了下。php的反射api一共有:
class 
Reflection 
{ }
interface Reflector 
{ }
class 
ReflectionException 
extends 
Exception 
{ }
class 
ReflectionFunction implements Reflector 
{ }
class 
ReflectionParameter implements Reflector 
{ }
class 
ReflectionMethod 
extends 
ReflectionFunction 
{ }
class 
ReflectionClass implements Reflector 
{ }
class 
ReflectionObject 
extends 
ReflectionClass 
{ }
class 
ReflectionProperty implements Reflector 
{ }
class 
ReflectionExtension implements Reflector 
{ }
Reflection 是最基础的反射类,比如
<?php
    Reflection::export
(new
ReflectionFunction
('array_walk'
));
    Reflection::export
(new
ReflectionClass
('Exception'
));

?>
将输出:
Function [ function array_walk ]
{
     
- Parameters [3]
      {
            Parameter #0 [ &$input ]

            Parameter #1 [ $funcname ]

            Parameter #2 [ $userdata ]

       }
}
CODE:
Class [ <internal> class Exception ] {
  - Constants [0] { }
  - Static properties [0] { }
  - Static methods [0] { }
  - Properties [6] {
    Property [ <default> protected $message ]
    Property [ <default> private $string ]
    Property [ <default> protected $code ]
    Property [ <default> protected $fil


相关文档:

PHP中foreach遍历数组(2)

<?php
  //声明数组变量
  $arr = array('张三','李四','王五','李明');
 
  //foreach循环遍历数组
  foreach($arr as $value){
   //注意“$value”后必须要一个空格,否则输出的结果不正确
   echo "$value<br/>";
  }
?> ......

[php]how to confirm deleting without using form.

<html>
<head>
<script type="text/javascript">
<!--
function confirmDelete()
{
    return confirm("Are you sure you wish to delete this entry?");
}   
//-->
</script>
</head>
<body>
<% $var1 = 2;%> ......

PHP出现Warning:Illegal offset type in

Warning
: Illegal offset type in
Warning
: Illegal offset type in isset or
empty in
前几天写程序的时候碰到一个这种错误提示
如果你使用这样的表示方法如下:
$arr = array();
class a
{
}
$o = new a;
echo $arr[$o];
就会出现上面的错误提示,因为不能使用实例化的对象来作为数组的索引,或者在使用i ......

php 解析 excel 存储到 mysql 乱码


编码是个很基础的问题,也是大家很容易忽略的问题,写代码之前多多考虑,以后会少很多麻烦。
PHP发展了不少,现在pear用起来很方便,其中就有相关的class来读取Excel文件里面的内容,如果不想使用pear的话,可以考虑使用excel_class.php,google一下,可以找到这个class的source code下载,也能找到基本的example c ......

PHP中如何更新数组

原文链接:http://www.phpdo.net/index.php/20100410/55.html
在PHP中更新数组的内容可以直接指定键名并且对该键名赋值。 例如:
 <?php
 $php = array(“php”,”phpdo”,”phpdo.net”);
 $php[2] = “www.phpdo.net”;
 print_r($php);
&nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号