这是我的index.php的摘录 我已经安装了作曲家,但一直找不到类Sim。
<?php
require '../vendor/autoload.php';
$app = new \Slim\Slim(array(
'templates.path' => '../templates'
));
$app->get('/api', function () use ($app) {
// Get the start and end timestamps from request query parameters
$startTimestamp = $app->request->get('start');
$endTimestamp = $app->request->get('end');
try {
// Open database connection
$conn = new \PDO('mysql:host=127.0.0.1;dbname=calendar', 'root', '');
// Query database for events in range
$stmt = $conn->prepare('SELECT * FROM events WHERE start >= FROM_UNIXTIME(:start) AND end < FROM_UNIXTIME(:end) ORDER BY start ASC');
$stmt->bindParam(':start', $startTimestamp, \PDO::PARAM_INT);
$stmt->bindParam(':end', $endTimestamp, \PDO::PARAM_INT);
$stmt->execute();
// Fetch query results
$results = $stmt->fetchAll(\PDO::FETCH_ASSOC);
// Return query results as JSON
echo json_encode($results);
} catch (\PDOException $e) {
$app->halt(500, $e->getMessage());
}
});
$app->get('/', function () use ($app) {
$app->render('calendar.html');
});
$app->run();
?>
我在做什么错?我正在尝试实现完整日历jquery插件
答案 0 :(得分:0)
1-您可以验证已安装的软件包composer info -i
2-让您大张旗鼓new \Slim\Slim
尝试
$app = new \Slim\App(array(
'templates.path' => '../templates'
));