調べても出てこなかったので質問なのですが、
PHPでロード済みのクラスをアンロードすることはできるのでしょうか?
namespace、class名を変更しろ!!の突っ込みはなしでお願いします。
PHP
1//■Test1.php 2class TestClass { 3 function test() { 4 echo "test1"; 5 } 6} 7 8 9//■Test2.php 10class TestClass { 11 function test() { 12 echo "test2"; 13 } 14} 15 16 17//■処理(下記みたいに処理をしたときにエラーにならないようにできる??) 18// Cannot declare class TestClass, because the name is already in use 19require_once Test1.php; 20//※アンロード処理 21require_once Test2.php; 22 23$obj = new TestClass(); 24$obj->test(); // ここでtest2を出す 25 26
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/16 06:55