php runkit,runkit Functions

RUNKIT_IMPORT_FUNCTIONS

(integer)runkit_import() flag indicating

that normal functions should be imported from the

specified file.RUNKIT_IMPORT_CLASS_METHODS

(integer)runkit_import() flag indicating

that class methods should be imported from the

specified file.RUNKIT_IMPORT_CLASS_CONSTS

(integer)runkit_import() flag indicating

that class constants should be imported from the

specified file. Note that this flag is only meaningful

in PHP versions 5.1.0 and above.RUNKIT_IMPORT_CLASS_PROPS

(integer)runkit_import() flag indicating

that class standard properties should be imported

from the specified file.RUNKIT_IMPORT_CLASSES

(integer)runkit_import() flag representing

a bitwise OR of the RUNKIT_IMPORT_CLASS_*

constants.RUNKIT_IMPORT_OVERRIDE

(integer)runkit_import() flag indicating that

if any of the imported functions, methods, constants,

or properties already exist, they should be replaced with

the new definitions. If this flag is not set, then any

imported definitions which already exist will be discarded.RUNKIT_ACC_PUBLIC

(integer)PHP 5 specific flag to runkit_method_add()RUNKIT_ACC_PROTECTED

(integer)PHP 5 specific flag to runkit_method_add()RUNKIT_ACC_PRIVATE

(integer)PHP 5 specific flag to runkit_method_add()CLASSKIT_ACC_PUBLIC

(integer)PHP 5 specific flag to classkit_method_add()

Only defined when classkit compatibility is enabled.CLASSKIT_ACC_PROTECTED

(integer)PHP 5 specific flag to classkit_method_add()

Only defined when classkit compatibility is enabled.CLASSKIT_ACC_PRIVATE

(integer)PHP 5 specific flag to classkit_method_add()

Only defined when classkit compatibility is enabled.CLASSKIT_AGGREGATE_OVERRIDE

(integer)PHP 5 specific flag to classkit_import()

Only defined when classkit compatibility is enabled.RUNKIT_VERSION

(string)Defined to the current version of the runkit package.CLASSKIT_VERSION

(string)Defined to the current version of the runkit package.

Only defined when classkit compatibility is enabled.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
runkit扩展库是pecl的php扩展的一部分。 runkit提供了一套函数,能让你动态的修改任意类和函数的定义。根据php提供的反射机制,得到所有用户定义的类和函数,你可以把他们重命名然后再用原来的函数名/方法名重新添加一个方法/函数,重新添加的函数的函数体,你可以任意定义---用字串儿,当你的php脚本开始执行时,你要最先 调用你设计的这个“钩子”,把所有的类的方法或函数都"钩"一遍,这样,不管是哪个方法在执行的时候,都会执行到你提供的切入点上的代码. 不过,在使用runkit的时候,还遇到一个问题:就是大小写的问题,起初,在“钩”方法的时候,有的方法带有大写字母,通过反射得到的方法名 也是区分大小写的,但是,应该在php解析执行函数的时候,还是把所有方法名或函数名都转换成了小写,这样,在用runkit提供的动态添加方法的函数添 加方法时,也忠实方法原来的命名,带着大写字母就直接添进去了,结果,再调用被钩的方法的时候,报错,死活也找不着原来的那个方法了,原因应该就 是,php在解析执行类、方法、函数时,应该都是按小写形式来定位的方法和函数的,而用runkit直接添加进去的带有大写字母的函数,自然就会找不到, 所以,在用runkit添加方法的时候,要把方法名都转换成小写,这样php就可以找到这个方法了,函数应该也是同样的. 示例代码: php.ini:runkit.superglobal=foo,bartest.php:function testme() {  echo "Foo is $foo\n";  echo "Bar is $bar\n";  echo "Baz is $baz\n";}$foo = 1;$bar = 2;$baz = 3;testme();输出:Foo is 1Bar is 2Baz is兼容性: PHP 4.2 or greater 标签:Runkit
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值