Ich habe diesen einen Code, der in localhost funktioniert, aber in meinem Server nicht funktioniert, habe ich einen Ordner namens Plattform der Pfad /var/www/html/platform
Autoload + Namespace arbeitet in localhost, aber funktionieren nicht in Server
Plattform/.htaccess
AcceptPathInfo On
RewriteEngine on
RewriteBase /var/www/html/platform/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?request=$1 [L,QSA]
plataform/autoload.php
function __autoload($className) {
$file = $className . '.php';
if(file_exists($file)) {
require_once $file;
}else{
//fail
}
plataform/index.php
include ('autoload.php');
$controller = new application\controllers\Controller();
plataform/application/controllers/Controller.php
namespace application\controllers;
class Controller{
}
In meinem localhost dieser Code funktioniert, aber in meinem Server erhalte ich die folgende Meldung:
Fatal error: Class 'application\controllers\controller' not found in /var/www/html/platform/index.php on line 12
Wie kann ich dieses Problem lösen? Ich benutze Ubuntu PHPMyAdmin on 14.04 (Digital Ocean)
.
Entspricht Ihr Autoloading dem PSR-4-Standard? Außerdem schaust du in spl_autoloading. –
@MueyiwaMosesIkomi PSR-4 Standard? spl_autoloading? Das ist neu für mich ... Ich verstehe nicht, worüber du sprichst ... Du hast ein Tutorial oder ähnliches? – Lacrifilm
Ich werde eine Antwort auf, wie ich mit meinem Autoload umgehen, funktioniert überall wo ich implementieren –