易截截图软件、单文件、免安装、纯绿色、仅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开发环境设置

1: apache服务器安装.apache_2.0.59-win32-x86-no_ssl.msi。
修改conf\httpd.conf中的文件,修改位置为:
DocumentRoot  "c:/webpage"  设置虚拟目录 c:/webpage.
DirectoryIndex  index.html  index.html.var   index.php
==使apache服务器识别php的扩展名。
在<Directory "c:/pr ......

PHP中foreach循环遍历数组

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

PHP中foreach循环遍历数组(3)

<?php
 
  //声明数组变量
  $arr = array(val1 =>'张三',val2 => '李四',val3 => '王五',val4 => '李明',val5 => '周燕妮');
 
  //foreach循环遍历数组
  foreach($arr as $key => $value){
   //注意“$value”后必须要一个空格,否则输 ......

PHP中内部函数使用方法

<?php
 
 
  //获得系统时间函数(注意参数中大写Y代表完整年份,小写y代表年份简写)
  $sum = date("Y-m-d");
  $sum1 = date("y-m-d");
 
  echo "$sum<br/>";
  echo "$sum1<br/>";
 
  //md5加密函数
  $pass = md5("张三");
  ......

[转]PHP获取IP地址

[转自]http://hi.baidu.com/xiamishule/blog/item/dea92c09ef9acc9e0b7b8236.html
源代码:
PHP获取IP的方法有许多种,<br />今天向大家总结了六种方法。
<br />PHP获取IP方法一:
<?php    
function GetIP() {
    if(!empty($_SERVER["HTTP_CLIENT_ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号