X-RayPHP 引擎编译器钩子

联合创作 · 2023-09-28 11:18

X-Ray 运行定义Zend 引擎 include()require() and eval() 钩子:

使用方法:

// adding a compiler hook:
xray\set_compiler_hook(function(string $source, string $filename = null) : string {
    if ($filename === null)  {
        // here we intercept source included through eval()
        // do transformations on $source and return the new $source to be included        
    }
    else {
        // here we intercept source included from a *.php file
        // do transformations on $source and return the new $source to be included
    }
});

// removing the compiler hook:
$hook = xray\restore_compiler_hook();

安装方法

git clone https://github.com/marcioAlmada/xray
cd xray
phpize
./configure
make
sudo make install

最后在你的 /etc/php.ini 中增加 extension=xray.so 

浏览 9
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报