hata için bir sınıf çağırma olduğunuHata:</p> <blockquote> <p>Class 'ControllerIndex' not found</p> </blockquote> <p>ama her an bütün kodda ben bu sınıfı diyoruz: Sebepsiz
test.php < < Script Executor
include_once("index.engine.php");
Index::importController();
use Controller\User;
echo User::getWorld(); // The error happens here.
Index.engine.php < < yılında dexer içerir
if (!defined('HOME')) define("HOME", __DIR__."/");
class Index{
public static function importModel(){
spl_autoload_register(function ($class) {
$nome = str_replace("\\", "/" , $class . '.model.php');
if(file_exists(HOME . $nome)){
include_once(HOME . $nome);
}
});
}
public static function importController(){
spl_autoload_register(function ($class) {
$nome = str_replace("\\", "/" , $class . '.controller.php');
if(file_exists(HOME . $nome)){
include_once(HOME . $nome);
}
});
}
public static function importPersistent(){
spl_autoload_register(function ($class) {
$nome = str_replace("\\", "/" , $class . '.persistent.php');
if(file_exists(HOME . $nome)){
include_once(HOME . $nome);
}
});
}
}
user.controller.php < < < < Fonksiyon yardım
namespace Persistent{
class Test{
public static function getEngine(){
$engine = "Engine is on! \o/";
return $engine;
}
}
}
Teşekkür gerekli Yalnızca bir ara
namespace Controller{
include_once (__DIR__ ."/../index.engine.php");
Index::importPersistent();
use Persistent\Test;
class User{
public static function getWorld(){
$result = Test::getEngine();
return $result;
}
}
}
user.persistent.php ben mi. Bunun için
Evet, doğru, ama kontrolü çağırmak ve komutu çalıştırmak istiyorum ... sorun, "indeksini" içe aktarmaya çalışıyor olması ve bunu istemiyorum. –
Sizi doğru anlarsam, denetleyiciden getWorld() yöntemini çağırmak ister misiniz? – cookies
http://prntscr.com/ar5q98 - Test dosyası için kontrol yöntemini arıyorum. –