学习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
相关文档:
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
//声明数组变量
$arr = array('张三','李四','王五','李明');
//foreach循环遍历数组
foreach($arr as $key => $value){
//注意“$value”后必须要一个空格,否则输出的结果不正确
echo "值$value 的下标为$key<br/ ......
<html>
<head>
<script type="text/javascript">
<!--
function confirmDelete()
{
return confirm("Are you sure you wish to delete this entry?");
}
//-->
</script>
</head>
<body>
<% $var1 = 2;%> ......
再次之前先说一个网址:https://www.paypaltech.com/SG2/
这个是生成paypal IPN的网址,这样说吧,是替你生成代码的网址(非常的好)!不懂没关系!先知道一下!
下载教程网址:http://download.csdn.net/source/2225766
http://download.cs ......
Magento遵循一般的方法使用第三方PHP库,即:将php库放到某个目录下,在php.ini或程序头部指定该目录或者父目录指定为include_path,然后程序中使用include_once相对路径包含具体引用的php文件
Magento的lib目录已经默认指定为include_path里了,所以如果有3rd包如Varien放到lib目录下,有一个php文件全名为$magento_h ......