PHP 笔记

1.PHP反射

<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

class Test
{
    private $c = 1;
    public function a($id)
    {
        echo 'ok a'.$id;
    }    

    private function b($id = 10018){
        echo 'ok b'.$id;
    }
}

$testClass = new ReflectionClass('Test');
$instance  = $testClass->newInstance();
$method = $testClass->getmethod('b');
$method->setAccessible(true);
$method->invoke($instance, 3);
$instance->a(1);
var_dump($testClass->getProperty('c'));

 

2. 依赖安装

  1.下载依赖  2. phpzie 编译安装依赖  3. 修改php.ini配置  4. 重启php-fpm

3.查看php扩展

  php -m

 

posted @ 2021-08-05 14:53  `YU  阅读(24)  评论(0)    收藏  举报