Basically what I need to do is:
$x = 'Admin';
$model = new \ReflectionClass($x);
$model->getFieldList();
Where I have Admin model inside app folder. Obviously, this doesn't work. Does anyone have any idea? Can it be done?
Basically what I need to do is:
$x = 'Admin';
$model = new \ReflectionClass($x);
$model->getFieldList();
Where I have Admin model inside app folder. Obviously, this doesn't work. Does anyone have any idea? Can it be done?
收起
you can do this, but you need to use the fully qualified class name.for example My models are in the Model
directory :
$model = 'App\Model\User';
$user=$model::where('id', $id)->first();
报告相同问题?