作曲家.json:
{
"require": {
"smarty/smarty": "v3.1.17"
}
}
索引.php:
define('SMARTY_SPL_AUTOLOAD', 1); // now smarty should use its own autoloader
require_once __DIR__ . "/vendor/autoload.php";
function my_classes_loader($class) {
$path = "{$class}.class.php";
if (file_exists($path)) {
include_once $path;
return true;
}
return false;
}
spl_autoload_register('my_classes_loader');
$smarty = new Smarty();
$smarty->setCompileDir("templates_c");
$smarty->display('main.html');
exit();
如果我在浏览器中打开它,我会得到
致命错误:在第 XX 行的 //smarty-example/vendor/smarty/smarty/distribution/libs/sysplugins/smarty_internal_smartytemplatecompiler.php 中找不到类“Smarty_Internal_TemplateCompilerBase”
文件在那里。它有内容。它对于 PHP 等是可访问/可读的。
我究竟做错了什么?什么不见了?