X-RayPHP 引擎编译器钩子
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
评论