在Java桥中找不到PHP类

在Java桥中找不到PHP类,java,php,tomcat7,php-java-bridge,Java,Php,Tomcat7,Php Java Bridge,对于一个项目,我需要在TomcatServer7上使用JavaBridge7.0.1。 一切都很顺利(例如test.php),但在我将项目放入其中后,出现了以下错误: Etat HTTP 500 - java.lang.RuntimeException: PHP Fatal error: Class 'Presenter' not found in C:\Developpements\eclipse\workspace\neon_2\.metadata\.plugins\org.eclipse.

对于一个项目,我需要在TomcatServer7上使用JavaBridge7.0.1。 一切都很顺利(例如test.php),但在我将项目放入其中后,出现了以下错误:

Etat HTTP 500 - java.lang.RuntimeException: PHP Fatal error: Class 'Presenter' not found in C:\Developpements\eclipse\workspace\neon_2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\JavaBridge\index.php on line 85
我可以看到有些PHP类在

Index.php


Flight.php的位置是什么?@AhmadRezk,看看我的编辑。所以,你说Flight加载良好,但演示者没有。正如我看到的,flight class目录的结构与presenter目录的结构不同,请尝试在此处使用绝对路径
$filename=“app/presenters/”$类名。“.php”不从应用程序启动,使用
\uuuuu DIR\uuuuuu
从根目录启动它不起作用,但如果我添加
require\u once“app/presenters/presenter.php”在开始时它工作。所以可能是因为
spl\u autoload\u register
无法在Javabridge环境中工作?如果(可读($filename)){
条件,您确定您的程序进入
<?php
session_start();

// error reporting
ini_set('display_errors', true);
error_reporting(1);


// autoload dependencies automatically via magical composer autoload
require_once 'vendor/autoload.php';

// website configuration file
require_once 'boot.php';

// db configuration file
require_once 'config.php';

// flight framework
require 'core/flight/Flight.php';

// custom functions
require_once 'func.php';

// autoload classes
require_once('autoload.php');

// error logging
if ($config['log_errors']) {
    Flight::set('flight.log_errors', true);
    $logFile = fopen($config['log_path'] . 'applog.log', 'a+');

    Flight::map(
       'error',
       function (Exception $ex) use ($logFile) {
           $message = date('d-m-Y h:i:s') . PHP_EOL . $ex->getTraceAsString() . PHP_EOL . str_repeat(
                 '-',
                 80
              ) . PHP_EOL . PHP_EOL;

           fwrite($logFile, $message);
           fclose($logFile);
       }
    );
}

// set config
Flight::set('config', $config);

// view path
Flight::set('flight.views.path', 'app/views/');

// set base path variable to be used in setting css js files in views
$request = (array) Flight::request();
Flight::set('base', $request['base']);
Flight::set('controller', $request['url']);
Flight::set('lastSegment', end(explode('/', $request['url'])));

// connect configuration
$database = $_SESSION['db'] ? $_SESSION['db'] : $config['database_dbname'];

ORM::configure('pgsql:host=' . $config['database_host'] . ';port=5432;dbname=' . $database);
ORM::configure('username', $config['database_user']);
ORM::configure('password', $config['database_password']);
$db = ORM::get_db();

// enable query logging
ORM::configure('logging', true);

Flight::set('db', $db);
Flight::set('dbname', $database);

$stmt = $db->query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'");
$data = $stmt->fetchAll(PDO::FETCH_NUM);
$data = arrayFlatten($data);

// create table names json file
$json = array();
foreach ($data as $datakey => $datavalue) {
    $json[]['word'] = $datavalue;
}

@file_put_contents('tables.json', json_encode($json));

$tables = Presenter::listTables($data);
Flight::set('tables', $tables);

if (false !== strpos($_SERVER['REQUEST_URI'], '/table')) {
    $currentTableKey = array_search(Flight::get('lastSegment'), $data, true);
    unset($data[$currentTableKey]); // remove current table

    // make dropdown options
    Flight::set('tablesOptions', getOptions($data));
}

// get an array of databases
$stmt = $db->query("SHOW DATABASES");
$data = $stmt->fetchAll(PDO::FETCH_NUM);
$data = arrayFlatten($data);
Flight::set('databaseOptions', getOptions($data, true, null, $database));

// setup custom 404 page
Flight::map(
   'notFound',
   function () {
       //include 'errors/404.html';
       header("HTTP/1.0 404 Not Found");
       exit('404 Not Found');
   }
);

// set global variables
Flight::set('appname', $config['appname']);

///////// setup routes /////////////
require_once 'routes.php';

// auto-logout after inactivity for 10 minutes
timeoutLogout(60);

// flight now
Flight::start();
<?php

// autoload classes from controllers/classes/presenters folders
function autoloadController($className) {
    if (false !== strpos($className, 'flight')) return;

    $className = strtolower($className);
    $filename = "app/controllers/" . $className . ".php";

    if (is_readable($filename)) {
        require $filename;
    }
}

function autoloadClass($className) {
    if (false !== strpos($className, 'flight')) return;

    $className = strtolower($className);
    $filename = "app/classes/" . $className . ".php";

    if (is_readable($filename)) {
        require $filename;
    }
}

function autoloadPresenter($className) {
    if (false !== strpos($className, 'flight')) return;

    $className = strtolower($className);
    $filename = "app/presenters/" . $className . ".php";

    if (is_readable($filename)) {
        require $filename;
    }
}

spl_autoload_register('autoloadController');
spl_autoload_register('autoloadPresenter');
spl_autoload_register('autoloadClass');
<?php

class Presenter
{
    public static function listTables(array $array)
    {
        $html = '';

        $base = Flight::get('base');

        $counter = 0;
        foreach ($array as $arrayitem) {
            $counter ++;

            $html .= <<< HTML
            <li><a href="$base/table/$arrayitem">$arrayitem</a></li>
HTML;
        }

        return $html;
    }

    public static function listTableData(array $array, $fieldTypes = array())
    {
        //$fieldTypes = convertFieldTypesEditable($fieldTypes);

        $html = '<table class="table table-striped table-bordered table-hover">' . "\n";
        $html .= '<thead>' . "\n";

        // build headings
        foreach ($array[0] as $head => $value) {
            $html .= "<th>$head</th>" . "\n";
        }

        $html .= '</thead>' . "\n";

        // build body
        $html .= '<tbody>' . "\n";

        //pretty_print($array);

        foreach ($array as $subArray) {
            $html .= '<tr>' . "\n";

            foreach ($subArray as $value) {
                $html .= '<td style="white-space: nowrap !important;">' . $value . '</td>' . "\n";
            }

            $html .= '</tr>' . "\n";
        }

        $html .= '</tbody>' . "\n";
        $html .= '</table>' . "\n";

        return $html;
    }
}