2017-04-20 119 views
0

我的代碼出現問題。我已經爲我的所有內容創建了一個全局文件。php class not found,但包含

define('A', 'app/'); 
define('C', 'config/'); 
define('S', 'classes/'); 
define('P', 'pages/'); 
define('J', 'ajax/'); 
define('T', 'post/'); 
define('B', realpath(dirname(__FILE__)) . '/'); 

/* 

Invoegen van de classes. Nieuwe classes gelieven bij te schrijven. De Letter voor de map is de link naar het bestand, zoals bij de 
eerdere voorbeelden weergegeven. 

*/ 



require_once(B . A . C . 'config.inc.php'); 
require_once(B . A . S . 'class.functions.php'); 
require_once(B . A . S . 'functions.php'); 
require_once(B . A . S . 'class.database.php'); 
require_once(B . A . S . 'class.users.php'); 

與阿賈克斯我張貼到postlogin.php

$.ajax({ 
    url: 'app/classes/ajax/post/postlogin.php', 
    type: "POST", 
    dataType: "json", 
    data: {method: method, email: email, password: password}, 
    //contentType: "application/json; charset=utf-8", 
    success: function (returnmsg) { 
     var bla = returnmsg.msg; 
     alert(bla); 
    }, 
    error: function (xhr, status, error) { 
     alert("error " +xhr.responseText); 
    } 
}); 

但是當我發佈到postlogin.php他doensn't找到我的課class.users.php

當我把這個在我的索引類將會工作。

postlogin.php: 

<?php 

return Users::AdminLogin(); 

?> 

希望有人可以幫助我..

附:對不起,英文不好,我希望有人能理解。

+0

你是否在'postlogin.php'中包含了包含變量的文件?你也可以分享你的目錄結構 –

回答

0

你需要在postlogin.php中包含你的「全局文件」。 PHP無法知道這個文件存在,並且您的AJAX請求會直接到postlogin.php。

你也可以只包括你的class.users.php文件。