Dynamically generate classes at runtime in php?

后端 未结 10 1049
一向
一向 2020-12-09 15:06

Here\'s what I want to do:

$clsName = substr(md5(rand()),0,10); //generate a random name
$cls = new $clsName(); //create a new instance

function __autoload(         


        
10条回答
  •  悲哀的现实
    2020-12-09 15:44

    Please read everyone else answers on how this is truly a very very bad idea.

    Once you understand that, here is a small demo on how you could, but should not, do this.


提交回复
热议问题