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

学习php Reflection(二)

(4)映射类(ReflectionClass)
ReflectionClass类允许你反向映射类。
<?
php
interface MySerializable  
{    
// ...}
class My
Object
 
{    
// ...}
/** A counter class */
class 
Counter 
extends
MyObject implements MySerializable 
{   const 
START 

0
;
    
private 
static 
$c 

Counter
::
START
;
    
/**Invoke counter
     * @access  public
     * @return  int */
    
public 
function 
count
() {  return 
self
::
$c
++;  }
}
// Create an instance of the ReflectionClass class
$class 
= new 
ReflectionClass
(
'Counter'
);
// Print out basic information
printf
(
"===> The %s%s%s %s '%s' [extends %s]\n" 
.
    
"     declared in %s\n" 
.
    
"     lines %d to %d\n" 
.
    
"     having the modifiers %d [%s]\n"
,
        
$class
->
isInternal
() ? 
'internal' 

'user-defined'
,
        
$class
->
isAbstract
() ? 
' abstract' 

''
,
        
$class
->
isFinal
() ? 
' final' 

''
,
        
$class
->
isInterface
() ? 
'interface' 

'


相关文档:

php基础应用:php批量转换文件编码

遍历目录文件,替换编码部分,删除原文件,再重新转码原文件内容,重新生成新文件。
function explorerdir($sDir){

static $aTempArr=array();
$dp=opendir($sDir);
while ($sFileName = readdir($dp)){

if ($sFileName !='.' && $sFileName !='..'){

......

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 ......

magento 使用第三方PHP库

Magento遵循一般的方法使用第三方PHP库,即:将php库放到某个目录下,在php.ini或程序头部指定该目录或者父目录指定为include_path,然后程序中使用include_once相对路径包含具体引用的php文件 
Magento的lib目录已经默认指定为include_path里了,所以如果有3rd包如Varien放到lib目录下,有一个php文件全名为$magento_h ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号