我目前正在使用 Propel 1.6 和 Symfony 2 自动加载器类。
我的问题是我可以访问第一个类,但它以某种方式无法访问其他类错误:
Fatal error: Class 'model\om\BaseUser' not found in C:\xampp\htdocs\gym\build\classes\model\User.php on line 20
XML
<?xml version="1.0" encoding="utf-8"?>
<database name="gym" namespace="model" defaultIdMethod="native">
build.properties
# Database driver
propel.database = mysql
# Project name
propel.project = gym
propel.namespace.autoPackage = true
propel.database.url = mysql:host=localhost;dbname=test
propel.database.user = root
propel.database.password =
PHP的
// Include the main Propel script
require_once '/propel/Propel.php';
// Initialize Propel with the runtime configuration
//Propel::init("/build/conf/gym-conf.php");
require_once realpath( dirname( __FILE__ ) ) . "/ClassLoader/UniversalClassLoader.php";
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces( array (
"build\classes\model" => realpath( dirname( __FILE__ ) ),
"Symfony\Component" => realpath( dirname( __FILE__ ) ),
"s" => __DIR__
));
$loader->register();
use \build\classes\model\User;
$a = new User;