我的班级命名约定:class.ClassName.php
我的类文件命名约定:class.classname.php(因此是strtolower)。
类文件位于包含路径:/home/content/XX/XXXXXX/html/projects/include/
//autoload.php
<?php
class Autoload {
public static function autoloadClasses($className) {
$className = strtolower($className);
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'include/class.' . $className. '.php';
require_once($file);
}
}
$register = spl_autoload_register('Autoload::autoloadClasses');
?>
//check4.php
<?php
$company = $s->company;
$projectName = 'development';
$items = array('type', 'scope', 'table', 'conditions');
$things = array('select', '*', 'todos', array('company'=>$company, PROJECT_NAME=>$projectName));
$combinedArray = array_combine($items, $things);
$q = new Query($combinedArray);
?>
已验证的类存在并包含在 http://technicheian.com/images/includedClasses.png
在每个使用类的页面上(例如,这个调用 Query;位于 class.query.php:
05-Nov-2011 20:18:30]PHP Fatal error: Class 'Query' not found in /home/content/XX/XXXXXX/html/projects/check4.php
在第 9 行
在 class.session.php 的末尾是$s = new Session
(这里注意说 $company 变量不应该为空)。
我已经阅读了几乎所有我能找到的文章、操作方法等。我错过了什么?
运行 php 5.2