swoole-framwork/va.php

28 lines
785 B
PHP
Raw Normal View History

2024-05-20 11:51:07 +08:00
<?php
require_once __DIR__.'/vendor/autoload.php';
/*use \Doctrine\Common\Annotations\AnnotationReader;
use \Doctrine\Common\Annotations\AnnotationRegistry;
use \App\test\MyRedis;
use \App\annotations\Value;
//获取反射对象 MyRedis
$rc = new ReflectionClass(MyRedis::class);
//获取反射对象的变量
$p = $rc->getProperty("conn_url");
var_dump($p);
$reader = new AnnotationReader();
//获取变量的注释中@Value的name
$anno = $reader->getPropertyAnnotation($p,Value::class);
var_dump($anno);
echo $anno->name;*/
$builder = new DI\ContainerBuilder();
$builder->useAttributes(true);
$container = $builder->build();
$myUser = $container->get(\baihand\test\MyUser2::class);
var_dump($myUser);
var_dump($myUser->getAllUsers());
var_dump($myUser->myredis->getValue());