取消设置类 [英] Unset Class
问题描述
我有一个完整的表单创建系统。有很多不同的问题类型,我必须检查该人所做的答案是否正确。
i have a complete Form creation System. There are many different Question Types and I have to check if the answer which the person had made is correct.
所有类型的问题都有自己的类将总是称为ItemClass这个类在它自己的文件中。每次问一个问题,我包括文件,有这个问题:我必须检查不同类型的问题在一个PHP文件。然后出现错误 - ItemClass已经声明。
All types of Questions has its own class will is always called ItemClass and this Class is in its own File. Everytime a Question is asked I include the File and the there is that problem: I have to check different types of Questions in one PHP-File. And then there comes the error - ItemClass already declarated.
有没有任何方法来取消设置类?
Is there any method to unset a Class?
有一个美好的一天!
推荐答案
我测试了你的解决方案,最后我得到一个想法:
我将类重命名为每个类型(ynItemClass,markItemClass,...),当我需要一个项目类型时,做出以下
I tested your solutions and finally I got an Idea: I renamed the Classes to each of it's type (ynItemClass, markItemClass, ...) and when I need a Item Type a made the following
$it = $item->item_type."ItemClass";
$test = new $it($smarty);
而且有效!
美好的一天!
Dominik
Have a nice Day! Dominik
这篇关于取消设置类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!